Hey All
Now I am in research how to add DKIM support in my java code , but I always get
an error .
We have built a SMTP server which is already support DKIM , and the follow
attachment "gmail.eml" is the email source code copied from gmail mailbox , and
this email is send out from our SMTP server. From the source code we can see
the DKIM verfiy is passed (by the header info of 'Authentication-Results')
In my first step research , I want use my own java code to signature this
message do what just like the SMTP server has done , and if I get the same
value of "Tag h" and "Tag bh" then I am win .
the follow is my steps :
1. get the value of "tag h" in DKIM-Signature , here I got value
"content-type:mime-version:x-mailer:message-id:subject:to:from:date:x-virus-scanned"
2. conjunct the headers
"content-type,mime-version,x-mailer,message-id,subject,to,from,date,x-virus-scanned"
and canonicalization it use relaxed algrithm (RFC4871 3.7 step 2), after this
step I got the follow value (between the 'begin line' and the 'end line'):
--------------begin------------
content-type:multipart/alternative; boundary="=====003_Dragon772507372542_====="
mime-version:1.0
x-mailer:Foxmail 6, 13, 102, 15 [cn]
message-id:<200811241434250171331(_at_)elink-u(_dot_)cn>
subject:a
to:"simon.zhxd" <simon(_dot_)zhxd(_at_)gmail(_dot_)com>
from:"admin" <admin(_at_)elink-u(_dot_)cn>
date:Mon, 24 Nov 2008 14:34:25 +0800
x-virus-scanned:amavisd-new at elink-u.com
-------------end-------------
3. calculate the hash value of the value of step 2 use sha256 algrithm .
4. signature the value of step 3 use RSA .
5. Base64-encoded the value of step 4 ,finally I go the value "
f8LqeqJqM+V9u97U4n06EHOAKa0Eo03TE8+dF6jNNxFSnPm5DwkzcCgKOkjHF+FPcDxgEaNF53GU//a2Aj2rsC/hyJbW0N2h+48D7xC8VLiYdpGfHfVCCOxVf26/eqRkY7kV3kYa3YbGS0mki44NHIbn4Hce3cVTwbf1q02Mjcc="
which is different from the value of "Tag b" in the eml file
both SMTP server and my java code use the same key pair . for deeply check I
also attached my java code .
I have lookup the RFC document many times and still cann't located where the
error is , If u can help me thanks a lot .
Simon Zhu
simon-zxd(_at_)sohu(_dot_)com
2008-11-26
dkim.zip
Description: Binary data
gmail.eml
Description: Binary data
_______________________________________________
dkim-dev mailing list
dkim-dev(_at_)mipassoc(_dot_)org
http://mipassoc.org/mailman/listinfo/dkim-dev