Suning
Suning

Reputation: 163

What's exactly body means in DKIM

Normally a mail will send both html part and plain text part, like this:

... Headers ...

This is a multi-part message in MIME format.

--q17TlmNAFniw=_?: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit

... Text content ...

--q17TlmNAFniw=_?: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit

... Html content ...

--q17TlmNAFniw=_?:--

In dkim, the body to hash measn which one?

Upvotes: 3

Views: 1597

Answers (2)

Jaysen Marais
Jaysen Marais

Reputation: 4134

When using the 'relaxed' DKIM canonicalization algorithm I have found that hashing the following results in a validating body hash and a valid DKIM signature for multipart/alternative emails (<CRLF> added for clarity, note the trailing <CRLF>)

--boundary<CRLF>
Content-Type: text/plain<CRLF>
Content-Transfer-Encoding: quoted-printable<CRLF>
<CRLF>
foo<CRLF>
--boundary<CRLF>
Content-Type: text/html<CRLF>
Content-Transfer-Encoding: quoted-printable<CRLF>
<CRLF>
bar<CRLF>
--boundary--<CRLF>

Upvotes: 3

Damien McGivern
Damien McGivern

Reputation: 4004

It depends on the canonicalization algorithm you are using. See http://www.dkim.org/specs/rfc4871-dkimbase.html#canonicalization

Upvotes: 0

Related Questions