A message carries two DKIM signatures, one rsa-sha1 and one rsa-sha256; under RFC 8301, how does a verifier evaluate them?
answer
- each signature on its own merits
- RFC 8301, January 2018
- rsa-sha1 permanently failed
- 1024-bit floor, 1024-4096 must-support
basics
~20 sEach DKIM signature is judged on its own. Under RFC 8301 (January 2018) the rsa-sha1 one has permanently failed and is ignored; if the rsa-sha256 one verifies with an RSA key of at least 1024 bits, the message has a valid signature.
solid answer
~50 sRFC 6376 section 4.2 says a verifier SHOULD evaluate multiple signatures independently and on their own merits, in any order it likes, and SHOULD keep checking until one verifies to its satisfaction; it MAY cap how many it tries. The `rsa-sha1` signature has permanently failed: RFC 8301 (January 2018) says `rsa-sha1` MUST NOT be used for signing or verifying. The `rsa-sha256` signature is checked normally, with one more gate from RFC 8301: verifiers MUST NOT consider valid a signature made with an RSA key under 1024 bits, and MUST be able to validate keys from 1024 to 4096 bits. If it verifies, the message has a valid signature for its `d=` domain, and the broken one is ignored rather than counted against it. Whether that `d=` is the one that matters for the From domain is decided by DMARC alignment.
go deeper
Recall that each DKIM signature is checked on its own, and that one signature that verifies is enough to give the message a valid signature for its domain.
Explain RFC 8301's verifier rules: rsa-sha1 has permanently failed, RSA keys under 1024 bits are never valid, and keys from 1024 to 4096 bits must be supported.
Show you can read a message with mixed results, a broken author signature beside a valid list signature, and say exactly which domain the receiver has authenticated.
Discuss how a receiver's policy might weigh key length or several signing domains beyond the RFC minimum, and the cost of being stricter than senders expect.
## Several signatures on one message A message can carry more than one `DKIM-Signature` header field. RFC 6376 section 4.1 and RFC 5863 section 6.5 give the common reasons: - a signer **moving between algorithms**, signing once with each so that older and newer verifiers both find one they accept; - a message passing through **several signers**, such as an author's domain and then a discussion list that signs what it sends; - a **service provider** signing with its own domain as well as with its customer's. RFC 6376 sets the verifier's rules: 1. The order of the fields means nothing: verifiers MUST NOT attribute ultimate meaning to it, because relays may reorder header fields. 2. Each signature SHOULD be evaluated independently and on its own merits. 3. A PERMFAIL or TEMPFAIL ends that signature only; the verifier SHOULD proceed to the next. 4. Verifiers SHOULD continue until a signature verifies to their satisfaction, and MAY limit the total they try, to blunt denial-of-service. The informative note behind rule 3 is the mailing-list case: a list that knowingly breaks the author's signature but adds its own should still see the message succeed. A broken signature beside a good one is ignored, not held against the good one. ## What RFC 8301 retired RFC 8301 (January 2018, Standards Track) updated RFC 6376's algorithm and key-size rules: | Item | Signer | Verifier | |---|---|---| | `rsa-sha256` | MUST sign with it | MUST be able to verify it | | `rsa-sha1` | MUST NOT sign with it | MUST NOT verify with it; such signatures have permanently failed | | RSA key under 1024 bits | not allowed: at least 1024 bits are required | MUST NOT consider the signature valid | | RSA key from 1024 to 4096 bits | SHOULD use at least 2048 | MUST be able to validate; MAY handle larger keys | `rsa-sha1` was one of the two algorithms RFC 6376 originally defined. RFC 8301 made it historic, citing the SHA-1 risks described in RFC 6194. A verifier that still passes an `rsa-sha1` signature is out of step with the standard, and RFC 8601 registered the `header.a` property partly so that receivers recording results can tell such signatures apart. RFC 8301 also lets **verifier policy** use key length as one metric for whether a signature is acceptable, so a receiver may weigh a 1024-bit signature less favourably than a 2048-bit one. The hard floor, below which no signature is valid, is 1024 bits. ## Working the two-signature example Take a message from `example.com` with two fields: - `a=rsa-sha1; s=s2018old; d=example.com` is treated as permanently failed without relying on its cryptography, and the verifier moves on; - `a=rsa-sha256; s=s2026a; d=example.com` makes the verifier fetch `s2026a._domainkey.example.com`, check that the RSA key is at least 1024 bits, then compare the body hash and verify the signature. The outcomes: | rsa-sha256 signature | What the receiver has | |---|---| | verifies | a valid signature for `example.com`; the `rsa-sha1` one is ignored | | fails | only bad signatures, so RFC 6376 says treat it like unsigned mail | | key lookup got no answer | a TEMPFAIL and no good signature, so the verifier MAY defer the message and try again | ## Ed25519 beside RSA RFC 8463 (September 2018) added `ed25519-sha256`, with key type `k=ed25519`. Verifiers **MUST** implement it; signers SHOULD. Because one selector holds one key record, a signer that sends both an RSA and an Ed25519 signature uses two selectors, possibly with the same `d=`. A verifier that does not yet support Ed25519 is out of step with RFC 8463, but under RFC 6376's independence rule it can still evaluate the RSA signature and reach a result. ## What a valid signature gives, per domain Each verified signature yields its own `d=` domain. When the signatures carry different domains, an author's and a list's for example, the receiver holds two authenticated identifiers, and how it weighs them is local policy. RFC 5863 notes that receivers vary, from ignoring all but one signature to blending the trust of all of them. Which of the domains counts for the visible From domain is the DMARC alignment question, covered with identifier alignment. ## Common mistakes - Treating the first `DKIM-Signature` field as the one that decides. - Letting one failed signature fail the whole message when another verifies. - Still accepting `rsa-sha1`, or a key shorter than 1024 bits, as a pass. - Reading a verified list signature as if it vouched for the author's domain.
- If a message's only DKIM signature uses a 768-bit RSA key and both hashes match, what is the result?Not a valid signature. RFC 8301 says verifiers MUST NOT consider signatures using RSA keys of less than 1024 bits valid, and such signatures have permanently failed evaluation. Matching hashes do not rescue it, because a key that short more easily succumbs to offline attack; the message is treated like unsigned mail.
- Does the order of two DKIM-Signature fields tell the verifier which one to trust?No. RFC 6376 lets verifiers try signatures in any order and says they MUST NOT attribute ultimate meaning to the order, because relays may reorder header fields. Order is at most a weak hint about signing sequence; each signature is judged on its own.
- One failed DKIM signature makes the whole message fail DKIM.
- rsa-sha1 is still acceptable for verification, just discouraged.
- The topmost DKIM-Signature field is the authoritative one.
- A 512-bit RSA key passes as long as the hashes match.
- A verifier must check every signature on a message, however many.