stalwartlabs / mail-auth

DKIM, ARC, SPF and DMARC library for Rust
https://docs.rs/mail-auth/
Apache License 2.0
82 stars 13 forks source link

Incorrect body hash when content is empty #22

Closed remipcomaite closed 8 months ago

remipcomaite commented 9 months ago

I have an error verifying the DKIM signature of emails whose content is empty. I believe there is a bug in the body hash calculation if the message body is empty.

Here are the tests I performed when the email is empty and when the email only contains the word "toto".

Empty:

https://mxtoolbox.com/deliverability/274cfab4-394e-474c-993d-9c1531f2f04f

Not empty:

https://mxtoolbox.com/deliverability/eb6c7a5a-5145-4290-baec-3a72bff09d70

mdecimus commented 9 months ago

Was that message signed by Stalwart? Because based on the Received headers it looks like it was signed by Postfix or OpenDKIM. If both Stalwart and MX Toolbox fail to verify the message then it is probably a Postfix issue.

remipcomaite commented 9 months ago

Indeed, in my case, outgoing emails are processed by Postfix but they are signed by Stalwart. These are the results of the tests I did with email addresses managed by Stalwart. I use Postfix as a relay. The test is carried out by sending an email to the address indicated here: https://mxtoolbox.com/deliverability

mdecimus commented 9 months ago

Great, I'll check it out.

mdecimus commented 8 months ago

This has been fixed in v0.3.7.