I'll comment on a few things that jumped out to me...
You might also be interested in the dkim-dev list, which (theoretically) is
more oriented toward developing DKIM-aware programs.
Jason
>>>> "rajvkau" <rajvkau@...> 4/3/08 9:50 AM >>>
>------------------------------------------------------------------
>MY INTERPRETATION
>Take the message body:
>1. Canonicalized using the body canonicalization algorithm specified
>in the "c=" tag
>2. Take the complete body (default value of "l-" tag)
>3. Signer Hashes the canonicalized message body
>4. Hash value is converted to Base64 form and inserted into signers
>(???)
>-------------------------------------------------------------------
inserted into the signature, yep.
>
>------------------------------------------------------------------
>MY INTERPRETATION
>Say by default we are signing the following header:
>canonicalization (Date: xxx) <CRLF>
>canonicalization (From: xxx) <CRLF>
>canonicalization (To:xxxx) <CRLF>
>canonicalization (Subject:xxxx) <CRLF>
>------------------------------------------------------------------
right, in the order specified by the h= tag of the signature.
>-------------------------------------------------------------------
>MY INTERPRETATION
>Canoncalization (DKIM-Signature: v=1; a=rsa-sha256; d=infor.com;
>s=rajtest; c=simple/simple; i=@*.infor.com; t=; x=; q=dns/txt;
>h=Date:From:To:Subject; z=; bh=; b=)
>-------------------------------------------------------------------
Well, the bh= tag should have a value when you are canonicalizing the
signature header. Only the b= tag is made blank for the purpose of
canonicalization.
>-------------------------------------------------------------------
>I am not sure here specs are talking about DKIM-Signature field or
>Header fields in general.
>
>From Step 2: It looks like
>canonicalization (Date: xxx) <CRLF>
>canonicalization (From: xxx) <CRLF>
>canonicalization (To: xxx) <CRLF>
>canonicalization (Subject: xxx) <CRLF>
>canonicalization (DKIM-Signature: xxx)
>
>But the following phrase seems to be contradictory.
>
> **** rather than with the rest of the header fields *****
>
That phrase makes more sense when you remember that DKIM used to use a
single hash for the entire message. So back then, it would be: canonicalize
the header fields (except the DKIM-Signature header), followed by the
message body, then finally the DKIM-Signature header.
>******************************************************************
>PSEUDO Algorithm
>
>What I am planning to do:
>
>1. Create a Signature Object [signature = Signature.getInstance
>("SHA256withRSA");]
>2. inputStreamBody = Canonicalized (body}
>3. signature.update (input StreamBody)
>4. inputStreamHeader = Canonicalized (date: xxx<CRLF>,from
>xxx<CRLF>,to xxx<CRLF>, subject: xxx<CRLF>, dkim-signature}
>5. signature.update (inputStreamHeader)
>6. byte[] decoded = signature.sign();
>7. Base64EncodedString = myBASE64Encoder(decoded);
>8. DKIM-Signature: v=1; a=rsa-sha256; d=infor.com; s=rajtest;
>c=simple/simple; i=@*.infor.com; t=; x=; q=dns/txt;
>h=Date:From:To:Subject; z=; bh=; b= Base64EncodedString)
>
>
>I am just wondering if my pseudo algorithm follows the specs or
>there could be a better implementation.
Before canonicalizing your dkim-signature, you need to compute the body
hash and insert its base64 value into the bh= tag of the signature.