tags:

views:

26

answers:

2

I have a script that is sending emails via SMTP and I'm trying to get it to sign emails with a DKIM signature using CPAN's Mail::DKIM::Signer. The trouble is I am getting error that the body hash is invalid. For example I sent the email below to the port25.com verifier and it is telling me the body hash it expected is "QFBPfFyqSONobf7fNoeeGl652WY=" but my signature says "qUFULrL5rN08Illvd85ZYXxgNNk=".

My DNS record is "k=rsa; t=s; p=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDs5BnRmpNH0Pz6B02+z F2GuLm7ahrEXu6zB3WgxySbAGT8v9rpzI7ePhXhxo/RMXR9p5IYtzmBJ0NTjNLDKRFeSOMTeRdDi8DnO 4gUxKyT3v31IvS0+1ZZH2Sj404uv/jg2TKNinIU4/v+pM4ImLZ8uIXsEXRFgGhwKTjTJRNX0QIDAQAB"

Is anyone able to shed some light onto why recipients (including yahoo & port25) are expecting a different body hash? Something to do with the way it's encoded?

This is a MIME encoded message.

--=_b4326086ed9a1ae338d4dabe6b015dde
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Hi this is a test of DKIM. Bye!

--=_b4326086ed9a1ae338d4dabe6b015dde
Content-Type: text/html; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<html>
<head>
<meta http-equiv=3D"Content-Type" content=3D"text/html; charset=3Diso-8859-=
1">
<style type=3D"text/css">
body,td,th { font-family: Verdana; font-size: 13px; color: #000000; }
body { background-color: #3895CB; margin: 0px 20px; text-align:center; }
</style>
</head>
<body>
Hi this a test of <b>DKIM</b>. Bye!
</body>
</html>

--=_b4326086ed9a1ae338d4dabe6b015dde--
A: 

Problem solved.

dos2unix on the email before signing it did the trick.

Does that means the problem was with carriage returns or something?

Tim
Who knows? You didn't show the Perl code you use, so it's only possible to speculate.
daxim
A: 

Hi Tim. I'am having the same problem on Mail::DKIM::Signer can you tell me where did you modified the code to make it work ?

tzimnel