Page
Library
Module
Module type
Parameter
Class
Class type
Source
Dkim.DigestSourceThe Digest module computes the cryptographic digests that underlie a DKIM signature. A signature covers two digests: one over a selection of header fields (including the DKIM-Signature header with the b= tag emptied), and one over the canonicalized message body.
Alias for the outer DKIM record type, re-exported inside Digest to avoid shadowing by the local t.
An in-progress hash computation, existentially quantified over the hash algorithm.
A first-class module type pairing a Digestif implementation with its key and context types.
A pair of a DKIM record and its corresponding in-progress digest. The 'signed parameter tracks whether the record is signed or unsigned.
An existentially packed (signed, 'k) value, hiding the hash type.
val digest_fields :
(Mrmime.Field_name.t * Unstrctrd.t) list ->
(Mrmime.Field_name.t * Unstrctrd.t * signed dkim * domain_key) ->
string * packdigest_fields others (field_name, unstrctrd, dkim, domain_key) computes the header digest. others is the list of all header fields (excluding DKIM-Signature) collected from the email. The function selects the fields listed in dkim.h, canonicalizes them, appends the canonicalized DKIM-Signature header (with the b= tag removed), and returns the raw digest bytes together with an initialized body digest ready to receive body data.
val digest_wsp :
[< `CRLF | `Spaces of string ] list ->
('signed, 'k) value ->
('signed, 'k) valuedigest_wsp payloads value feeds whitespace and CRLF tokens into the body digest. Under relaxed canonicalization, runs of whitespace are collapsed to a single space.
digest_str data value feeds a chunk of body data (not whitespace) into the body digest.
verify ~fields ~domain_key value finalizes the body digest and verifies the DKIM signature. fields is the raw header digest obtained from digest_fields. Returns a pair (body_hash, fields_valid) where body_hash is the raw hash of the canonicalized body and fields_valid is true if the cryptographic signature over the headers is valid.