openpgp and key expiry problem

296 views
Skip to first unread message

James

unread,
Jul 20, 2015, 6:19:50 PM7/20/15
to golang-nuts
Hi,

I had my GPG key expire recently and after updating the expiry date I can no longer read my secring.gpg. Here's a test app I wrote


Which explodes like this:
$ go run secring.go
panic: openpgp: invalid data: user ID self-signature invalid: openpgp: invalid signature: hash tag doesn't match

goroutine 1 [running]:
main.main()
/Users/james/Development/Projects/goplay/secring.go:25 +0x237

goroutine 17 [syscall, locked to thread]:
runtime.goexit()
/usr/local/Cellar/go/1.4.2/libexec/src/runtime/asm_amd64.s:2232 +0x1
exit status 2
Exit 1

I can still use the cmdline gpg tools (encrypting and decrypting), so I'm thinking this is either something non-standard that GPG is using or a bug in the library?

I traced it back to here, but I don't know enough about OpenPGP.

This doc https://www.gnupg.org/gph/en/manual/c235.html suggests there might be additional self-signatures?
A key's expiration time is associated with the key's self-signature. The expiration time is updated by deleting the old self-signature and adding a new self-signature. Since correspondents will not have deleted the old self-signature, they will see an additional self-signature on the key when they update their copy of your key. The latest self-signature takes precedence, however, so all correspondents will unambiguously know the expiration times of your keys.
 
Any ideas?

Thanks
James

James

unread,
Jul 20, 2015, 10:44:05 PM7/20/15
to golang-nuts
Okay. I got this working by not returning an error on the first invalid signature.

When I change this line to `break`

It eventually finds a single valid signature. This seems to match what the GPG docs say "the latest self-signature takes precedence". Not sure this is the correct patch however.

j...@nella.org

unread,
Jul 21, 2015, 1:06:17 PM7/21/15
to golan...@googlegroups.com
I think I agree with your analysis of the problem, but your code change probably isn't right. What if none of the packets have a valid signature? We'll need to move that error return down to a if len(current.Signatures) == 0 at the bottom, probably.

I'd say file an issue on it and we'll get it fixed. Providing a test secring.gpg file that shows the problem would be very helpful. (Don't send us your real secret key!)

  -jeff 

Reply all
Reply to author
Forward
0 new messages