hockeypuck / hockeypuck Public
forked from cmars/hockeypuckNew 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
Key browser displays incorrect subkey expiry dates #140
Comments
|
This is exactly reproducible on any hockeypuck server - the exact same timestamp discrepancies can be seen on keyserver.ubuntu.com and pgp.cyberbits.eu - so it is a deterministic bug in the subkey parsing code. There are similar errors on many other keys, although the error amount differs. For example, @cmars has an old key with subkeys that appear to have negative lifetimes: I'm looking into it now to see if there's a mathematical pattern. |
|
I've finally worked out what's going on. PGP (sub)key expiry is stored as an interval in seconds since the (sub)key creation date, which is itself stored in Unix epoch format. In order to display an expiry date in human readable format, we must add the expiry interval (in seconds) to the creation date (in seconds since the epoch) and interpret the result as seconds since the epoch. What seems to be happening in hockeypuck is that for subkeys, it is adding the expiry interval of that subkey to the creation date of either the first subkey or the primary key (the timestamps are usually the same). This can be seen in the attached spreadsheet, which uses my key and that of another keyserver operator as references. Only keys with more than one subkey are therefore affected. hockeypuck-date-discrepancy.xlsx The columns are populated from the creation and expiry dates as shown by hockeypuck, compared with the corresponding dates as reported by [CORRECTED: it is the creation time of either the first subkey or the primary key that is erroneously used, not the previous subkey] |
|
The error appears to be at src/hockeypuck/openpgp/io.go line 181: ParseSignature() eventually calls Signature.setSignature() (src/hockeypuck/openpgp/signature.go line 116) which overloads sig.Expiration with the key expiration date if s.KeyLifetimeSecs is non-nil: Note that this is dependent on having been passed the appropriate
This could be read ambiguously (I'll open an issue with the -bis WG now) but the common interpretation is that if a direct sig is made on the primary key, the expiration is calculated relative to the creation of the primary key, but for an sbind, the relevant creation is that of the subkey. This distinction is not made in IMO, overloading the semantics of sig.Expiration is fundamentally confusing, however we don't need to refactor that deeply to fix this particular issue. We just need to declare a variable |
|
The ambiguity in the spec is tracked in https://gitlab.com/openpgp-wg/rfc4880bis/-/merge_requests/113 |
Browse my key on e.g. de.pgpkeys.eu (built from current master):
https://de.pgpkeys.eu/pks/lookup?search=0x00CC54C6A0C601691AF4931FFB73E21AF1163937&fingerprint=on&exact=on&op=index
At the bottom, note the sbind expiry dates:
These are incorrect, as can be demonstrated by importing to a fresh gnupg keybox:
or by requesting the same key from an SKS server, e.g. sks.pgpkeys.eu:
http://sks.pgpkeys.eu/pks/lookup?op=vindex&fingerprint=on&search=0xFB73E21AF1163937
The text was updated successfully, but these errors were encountered: