Description
What version of Go are you using (go version
)?
go version go1.9 darwin/amd64
Does this issue reproduce with the latest release?
Yes.
What operating system and processor architecture are you using (go env
)?
darwin amd64
What did you do? / What did you expect to see? / What did you see instead?
The KeyExpired()
method on the packet.Signature
struct checks if the signature creation time is after the key expiration time specified by the signature:
// KeyExpired returns whether sig is a self-signature of a key that has
// expired.
func (sig *Signature) KeyExpired(currentTime time.Time) bool {
if sig.KeyLifetimeSecs == nil {
return false
}
expiry := sig.CreationTime.Add(time.Duration(*sig.KeyLifetimeSecs) * time.Second)
return currentTime.After(expiry)
}
According to RFC 4880 section 5.2.3.6, this method should be using the key creation time instead of the signature creation time:
5.2.3.6. Key Expiration Time
(4-octet time field)
The validity period of the key. This is the number of seconds after
the key creation time that the key expires. If this is not present
or has a value of zero, the key never expires. This is found only on
a self-signature.
These timestamps will often be the same, but not necessarily. The method is used in several places in keys.go
and this behavior could cause expired keys to be used inappropriately.