Refuse a signature made when its key was not valid (closes #209)
check / check (push) Waiting to run

verifySignature lets a key that has expired since verify a signature,
because a manifest outlives its key, but it checked the key only as of
now. It accepted a signature dated after its key expired, after the
key's self-signature or the signing subkey's binding signature expired,
or before the key was made. It now verifies a second time with the
library's clock set to the signature's creation time and refuses the
signature if the key or subkey was not valid then. docs/FORMAT.md
states the rule.

Judgement call: the tests make the refused signatures with the
library's packet API, because openpgp.DetachSign will not sign with a
key that is not valid at its clock's time.

Model: opus-5-5
This commit is contained in:
2026-10-13 21:23:12 +00:00
parent 24496880c5
commit 812ea2fa66
3 changed files with 164 additions and 8 deletions
+12 -3
View File
@@ -174,9 +174,18 @@ also refuses a manifest whose `signingPubKey` holds a DSA key or subkey, or any
secret key or subkey, since checking the self-signatures of a DSA key or the
numbers of a secret key can take hours when those numbers are very large.
A signing key that has expired does not make the signature bad, because a
manifest outlives its key. A signature past its own expiry time is not good,
whether or not the key has expired too.
A signature is good only if the primary key, and the subkey that made the
signature, were valid at the signature's creation time under the key validity
rules of RFC 9580. The key is judged by its current self-signatures and binding
signatures: for a version 4 key the newest self-signature on its primary user
ID, for a version 6 key its newest direct-key signature, and for a subkey its
newest binding signature with the signature embedded in it. So a signature made
before the newest of those is not good, even if an older one made the key valid
at that time. The reference implementation checks this by verifying the
signature a second time with its clock set to the signature's creation time. A
key that has expired since does not make the signature bad, because a manifest
outlives its key. A signature past its own expiry time is not good, whether or
not the key has expired too.
## Deterministic Serialization