Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DKIM body hash mimepart with only newline #221

Closed
breedbekkikker opened this issue Jan 22, 2016 · 8 comments
Closed

DKIM body hash mimepart with only newline #221

breedbekkikker opened this issue Jan 22, 2016 · 8 comments
Labels
bug Something isn't working

Comments

@breedbekkikker
Copy link

DKIM body hash calculation fails when there is a mimepart with only a newline as content.

Example:
----_com.android.email_0000000000000000
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: base64
[CR][LF]
[CR][LF]
----_com.android.email_0000000000000000--

The body hash is calculated over:
----_com.android.email_0000000000000000
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: base64
[CR][LF]
----_com.android.email_0000000000000000--

While there have been several issues before with reserialization of mimeparts, I was wondering why you do not chose for DKIM to use the raw body and perform the canonicalization on that. Thus using the body as-is without all the hassle of breaking the body up into the mimeparts and then reserialize them to get the original body. Imho this would make body hash calculation more simple with less chance for errors.

@jstedfast
Copy link
Owner

I don't have the raw body, I only have the MIME tree structure and have to reserialize.

@jstedfast
Copy link
Owner

This issue should already be fixed in git master, but I have not made a release yet.

@jstedfast jstedfast added the bug Something isn't working label Jan 22, 2016
@jstedfast
Copy link
Owner

isn't this the same bug as #213 ?

@jstedfast
Copy link
Owner

never mind, I see the difference. I'll test it out and make sure this works.

jstedfast added a commit that referenced this issue Jan 22, 2016
@jstedfast
Copy link
Owner

This is fixed now.

@breedbekkikker
Copy link
Author

Thank you very much for your prompt response/fix.

@jstedfast
Copy link
Owner

No prob. Thanks for submitting these bug reports, they are very helpful in ironing out the kinks.

FWIW, this re-serialization logic needs to work for S/MIME and OpenPGP as well, and there's no way I could just stream the complete raw messages through a filter to verify those signatures since it they only apply to subsections of the message.

@jstedfast
Copy link
Owner

I pushed MimeKit 1.2.20 to nuget last night with this fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants