Karta. Auth. DKIM. Canonical
(Karta v1.0.0)
DKIM canonicalisation (RFC 6376 §3.4) and the data a signature covers (§3.7), on the bytes of a message as received.
Header fields come from Karta.Mail.Headers.split/2, which keeps each
field's raw bytes, so "simple" really is unchanged.
Summary
Functions
The body canonicalised.
Every run of spaces and tabs turned into one space.
One header field, canonicalised, ending in CRLF.
The header data a signature covers (RFC 6376 §5.4.2): for each name in
names, the last field of that name not yet used, searching from the
bottom of the header; a name with no field left adds nothing. Then the
signature field itself with its b= value removed, canonicalised,
without its final CRLF.
The field with the value of its b= tag removed, folding inside the
value included, as a verifier must hash it (RFC 6376 §3.5, the b= tag).
Types
Functions
The body canonicalised.
:simple: empty lines at the end removed and a final CRLF ensured (an
empty body becomes CRLF). :relaxed: in addition, runs of spaces and tabs
become one space and white space at the end of each line is removed; an
empty body stays empty.
Every run of spaces and tabs turned into one space.
@spec header(Karta.Mail.Header.t(), algorithm()) :: binary()
One header field, canonicalised, ending in CRLF.
:relaxed: the name in lower case, the value unfolded, runs of spaces
and tabs turned into one space, white space at the end of the value and
around the colon removed. :simple: the field exactly as received.
@spec signed_headers( [Karta.Mail.Header.t()], [String.t()], Karta.Mail.Header.t(), algorithm() ) :: iodata()
The header data a signature covers (RFC 6376 §5.4.2): for each name in
names, the last field of that name not yet used, searching from the
bottom of the header; a name with no field left adds nothing. Then the
signature field itself with its b= value removed, canonicalised,
without its final CRLF.
@spec without_b(Karta.Mail.Header.t()) :: Karta.Mail.Header.t()
The field with the value of its b= tag removed, folding inside the
value included, as a verifier must hash it (RFC 6376 §3.5, the b= tag).