Why does an S/MIME signature from a law firm show as invalid after a discussion-list server adds a footer, and what can the firm change?
answer
- what the digest covers
- first part, byte for byte
- footer, re-encoding, rewrapping
- 7-bit before signing
basics
~20 sA detached S/MIME signature covers the first part of multipart/signed byte for byte; a list that appends a footer inside it, re-encodes it or rewraps lines changes those bytes. The firm can sign 7-bit-encoded content, change list settings, or sign opaquely.
solid answer
~50 sIn `multipart/signed` the signature covers the first part exactly as signed, including its MIME header fields, and the receiving client digests the bytes it actually receives. A list server that inserts a footer into that part, converts 8-bit text to another transfer encoding, rewraps lines or strips trailing spaces changes those bytes, the digest no longer matches `messageDigest`, and the client reports a broken signature. RFC 1847 says agents must treat the whole `multipart/signed` as opaque and must not change even its transfer encoding, but list software does not always comply. The firm can make its clients transfer-encode signed content to 7-bit, as RFC 8551 requires for `multipart/signed` sent over SMTP; ask list operators to leave signed mail alone or add footers as a separate part outside the signed one; or sign opaquely where every reader has S/MIME.
go deeper
Recall that a clear-signed message's signature covers the first part's exact bytes, so any change to that part breaks it.
Explain which list changes break the signature (footer in the part, re-encoding, rewrapping, From escaping) and which do not (Subject tags, outer headers).
Diagnose from both copies: confirm the format, compare the transfer encoding and the end of the first part, then fix encoding on your side and settings on the list's side.
Decide who owns the fix: the firm controls encoding and format, list operators control rewriting, and opaque signing trades reach for robustness.
## What a detached signature actually covers A clear-signed S/MIME message uses `multipart/signed` (RFC 1847). Its first part is the signed content; its second part, `application/pkcs7-signature`, holds a CMS `SignedData` with no content of its own. When verifying, the recipient's client takes the first part **exactly as received** — its MIME header fields and its body — computes its digest, and compares the result with the `messageDigest` signed attribute. One changed octet anywhere in the first part produces a different digest and a failed signature. RFC 1847 anticipated this. The entire `multipart/signed` container must be treated as opaque while in transit, and intermediate agents must not alter it in any way, including changing the transfer encoding of the body part. It also limits the signature's reach: it applies only to what is inside the container, not to anything around it. ## What a discussion-list server typically changes List software exists to rewrite messages, which makes it the classic place where clear-signed mail breaks. The changes that matter here: - **A footer appended to the text of the first part** — an unsubscribe line, a disclaimer. This is the change the firm's case describes. - **Transfer-encoding conversion** — 8-bit text re-encoded as quoted-printable, or the reverse, for a hop that is not 8-bit clean. - **Line handling** — rewrapping long lines, changing line endings or stripping trailing whitespace. - **Escaping** — some transport agents insert `>` before a line beginning with `From `, which RFC 8551 warns invalidates a signature. - **A tag in `Subject`**, such as `[clients]` — this one does **not** break the S/MIME signature, because the outer `Subject` header field is outside the signed entity unless the sender wrapped the whole message in `message/rfc822`. ## Telling which change happened An administrator can compare the copy the firm sent with the copy a recipient received: 1. **Confirm the format.** A `multipart/signed` header with `protocol="application/pkcs7-signature"` means a detached signature. An `application/pkcs7-mime` header with `smime-type=signed-data` means the opaque form, whose signed bytes a footer added outside it cannot reach. 2. **Compare the first part's `Content-Transfer-Encoding`** in both copies; a difference means a hop re-encoded it. 3. **Look for added text** at the end of the first part, and for changed line lengths or trailing spaces. 4. **Check where the footer went.** If the list added it as a new part outside the signed container, the signature over the inner part can still verify; RFC 8551 requires clients to treat the signed piece and unprotected content as having different origins. ## What the firm can change | Option | What it fixes | What it costs | |---|---|---| | 7-bit transfer encoding of the content before signing | re-encoding and 8-bit damage | slightly larger messages | | Encoding lines that begin with `From ` and trailing spaces | escaping and whitespace stripping | nothing a reader notices | | Lists set to leave signed mail alone, or to add footers outside it | footer damage | relies on list operators the firm may not control | | Opaque `application/pkcs7-mime` signing | benign rewrites of the content | readers without S/MIME cannot open the message | | Sending advice directly instead of through the list | all of the above | loses the list's distribution | RFC 8551 section 3.1.3 makes the first option a requirement: a `multipart/signed` entity that will travel over Internet SMTP **MUST** have transfer encoding applied so that it is 7-bit text. The reason is that a relay unable to carry 8-bit data has only bad choices — change the transfer encoding (invalidating the signature), pass the data anyway with the eighth bit likely corrupted (invalidating it too), or return the message. Because RFC 1847 forbids changing the encoding, a compliant relay returns it. RFC 8551's sample canonical entity adds the practical advice: encode lines that begin with `From ` and trailing whitespace, so that gateways which rewrite them leave the signature intact. ## Why this is a senior question The fix is rarely one setting. The firm controls its own clients' encoding and its choice of signed format; it does not control a client's discussion list. A strong answer separates four things: - what the signature covers — the first part's bytes; - what broke it — a change inside that part; - what does not break it — a subject tag, a footer added outside the container, a new `Received` header field; - which party has to act — the firm's mail administrators, or the list's operator. A domain-level signature on the same message may break for the same reason; that is diagnosed with the material on DKIM verification, not here.
- Would switching the law firm to opaque S/MIME signing stop the discussion list from breaking its signatures?Largely. In `application/pkcs7-mime` with `smime-type=signed-data` the signed bytes are sealed inside the DER object, so re-encoding or a footer added outside it cannot reach them. But list members without S/MIME then see only an `smime.p7m` attachment they cannot open, which defeats the point of a discussion list. Most firms keep clear-signing and fix encoding and list settings instead.
- Why does a list's subject tag leave an S/MIME signature valid when its footer breaks it?The S/MIME signature covers the MIME entity in the first part of `multipart/signed`, not the outer header fields such as `Subject`, so a tag there changes nothing the digest covers. Only a sender that wraps the full message in `message/rfc822` brings the header fields under the signature, and even then the outer copy can change while the inner, signed copy stays intact.
- A signature broken after a mailing list always means deliberate tampering.
- A [clients] tag added to the Subject breaks the S/MIME signature.
- Re-encoding the first part keeps the signature valid because the decoded text is the same.
- Switching from SHA-256 to SHA-512 makes the signature survive the list.
- RFC 1847 allows relays to change the transfer encoding of a signed part.