Subject: [ietf-dkim] Clarification needed for "Computing the Message Hashes"

From: Michael Ströder <[email-masked]>
Date: Thu, 06 May 2010 13:51:13 +0200

HI!

I wondered about a sentence in section 3.7. of RFC 4871:

   [..] The header field MUST be presented to
   the hash algorithm after the body of the message rather than with the
   rest of the header fields and [..]

http://www.dkim.org/specs/rfc4871-dkimbase.html#hashing

What does "the body of the message" mean exactly? The 1. body-hash or really
2. the whole message body (again)?

The more formal description implies 1.:

    body-hash = hash-alg(canon_body)
    header-hash = hash-alg(canon_header || DKIM-SIG)
    signature = sig-alg(header-hash, key)

Ciao, Michael.
_______________________________________________
NOTE WELL: This list operates according to 
http://mipassoc.org/dkim/ietf-list-rules.html

---

From: "Murray S. Kucherawy" <[email-masked]>
Date: Thu, 6 May 2010 09:32:39 -0700

> -----Original Message-----
> From: [email-masked] [mailto:ietf-dkim-
> [email-masked]] On Behalf Of Michael Ströder
> Sent: Thursday, May 06, 2010 4:51 AM
> To: [email-masked]
> Subject: [ietf-dkim] Clarification needed for "Computing the Message
> Hashes"
> 
> HI!
> 

You're computing two hashes.  The first is a hash over the signed header fields (which gets stored in the "bh="), and the second is over the body followed by the (incomplete) DKIM-Signature header field.

---

From: Michael Thomas <[email-masked]>
Date: Thu, 06 May 2010 09:47:37 -0700

> You're computing two hashes.  The first is a hash over the signed header fields (which gets stored in the "bh="), and the second is over the body followed by the (incomplete) DKIM-Signature header…

Did you write that correctly, Murray? The *body* hash gets stored into bh. I think you mean

I'm trying to make sense of what you wrote, and I'm sort of not getting it altogether.

But I think he's right: it's meaning number 1. bh= gets body-hash, header-hash is the
h= values, and DKIM-SIG is the to-be created signature header, minus the value part of b=.

Mike

---

From: "Murray S. Kucherawy" <[email-masked]>
Date: Thu, 6 May 2010 10:00:12 -0700

> From: Michael Thomas [mailto:[email-masked]]
> Sent: Thursday, May 06, 2010 9:48 AM
> To: Murray S. Kucherawy
> Cc: Michael Ströder; [email-masked]
> Subject: Re: [ietf-dkim] Clarification needed for "Computing the
> Message Hashes"
> 
> You're computing two hashes.  The first is a hash over the signed
> header fields (which gets stored in the "bh="), and the second is over
> the body followed by the (incomplete) DKIM-Signature header field.
> 

Sorry, yes.  That was my pre-coffee answer.  It's:

1) Compute the body hash.  Store that in "bh=".

2) Compute a hash over all the header fields to be signed, in order, including the partial DKIM-Signature header field at the end without a trailing CRLF.

3) Encrypt that.  Store that in "b=".