-
Notifications
You must be signed in to change notification settings - Fork 17.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
x/crypto/openpgp: Incorrect comparison when checking if PGP key is expired #22312
Comments
/cc @agl |
Any opinions here on what the correct behavior is? I'm reluctant to work around this in my app without being more sure that the current behavior is incorrect. |
@mastahyeti I'm with you. I believe this function is incorrect. |
Sure, this should be fixed. Signature creation time (together with signature expiration time subpacket) is used to allow to expire signature itself, not the key. |
/cc @FiloSottile Looks like people really love to fix this issue: https://mailarchive.ietf.org/arch/msg/openpgp/f--SM0L4y4kicxuLER9WLWs-5uc |
I agree with @mastahyeti and @paulfurley that this is a bug. the expiration date should be calculated from the key creation time. Note that Key expiration time is distinct from Signature expiration time. I believe that Go's |
I'd normally try to contribute a pull request to https://github.com/golang/crypto/, but it appears that the API here is typically invoked directly on the Signature object, which doesn't have a pointer back to the key object it refers to. So i think there might need to be an API change to fix this bug :( |
Seems logical that this method should be moved to key object instead of signature. For instance, key may have multiple self-signatures for multiple user ids (or have none) and theoretical ideal implementation must take care of that. |
Please send a CL with a |
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 thepacket.Signature
struct checks if the signature creation time is after the key expiration time specified by the signature:According to RFC 4880 section 5.2.3.6, this method should be using the key creation time instead of the signature creation time:
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.The text was updated successfully, but these errors were encountered: