-
-
Notifications
You must be signed in to change notification settings - Fork 373
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 - signature fails if message Content-Type is: multipart/alternative #178
Comments
My guess is that in both DkimSimpleBodyFilter.cs and DkimRelaxedBodyFilter.cs an extra NewLine is added when flush is true and the buffer does not end with a NewLine, while the canonicalization methods only require to add a NewLine if the body does not end with a CRLF. Currently, (flush && !lastWasNewLine) can be true even if we are not yet at the end of the body. |
The problem is that MimePart.WriteTo() will flush the stream after transcoding the content in cases where the content is not already in its target encoding. Fixes issue #178
Fixed. |
I've just released MimeKit 1.2.13 to nuget.org with a fix for this issue. |
Thanks. It works great now. |
I maybe wrong, but I think even the latest versions exhibit the similar problems. I put it as question in SO, because I wasn't really sure. Regards, |
Are you calling |
Sorry, I did miss it, that was, my bad.
It works perfectly now!.
Regards,
Krishnan
…On Wed, Feb 1, 2017 at 12:39 AM, Jeffrey Stedfast ***@***.***> wrote:
Are you calling message.Prepare () before DKIM signing? If not, that's
the problem you are hitting.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#178 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAJe1TLDHqoMO2IO8NhA8nqIbmgxEUW3ks5rX4b-gaJpZM4GKexP>
.
|
receiving Details: message has been altered error messaged |
@VickyKhan123 do you know for sure that the signature is good and that the message has not been altered? |
I solved it, as there was a rule on the firewall scanning outgoing SMTP traffic, I have some questions
|
Glad you figured out the issue. Let me try to answer your questions below:
|
thanks, i will check how to enable SMTP scanning and not altered . <source_ip>X.X.X.X</source_ip> |
Hello,
I've been trying to implement DKIM message singing with the help of your library.
The service that I've been using for validating DKIM is: http://dkimvalidator.com/
The DKIM signature validation passes if I build a simple mail message. The DKIM signature verification fails if message Content-Type is: multipart/alternative (method GenerateWithBodyBuilder()).
It also fails at Gmail (dkim=neutral (body hash did not verify) header.i=@dev.postar.eu).
Original message received by dkimvalidator.com:
Received: from [127.0.0.1](unknown [212.18.43.120])
by ip-10-212-6-2 (Postfix) with ESMTPS id F1F4B38065F
for postar@dkimvalidator.com; Wed, 7 Oct 2015 11:14:07 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; d=dev.postar.eu; s=postar1024;
c=relaxed/relaxed; t=1444223643; h=from:to:subject:date:message-id;
bh=YFTLzdVcmulRq0rD7JHqdnjql/4m85WwE3/c73oFChw=;
b=Lauijgc+6haOkOfEsxpEO2VggdplHNM+o9jRlslyr6AmZnqmnfdy/oIaFpF5l4UD7VnugXZ3Yec
C9zfbrkHBSWZ17NtdLkk4SuCoLgkXA1e6XBiqKjFaDxpvbd4FXjUQYVgZ0/1dHS1Nf9zrTHes1/Pg
suCrbCWRWZhnShtdtj0=
From: Joey joey@friends.com
To: DKIM postar@dkimvalidator.com
Date: Wed, 07 Oct 2015 13:14:03 +0200
Subject: DKIM signature validation test which fails
Message-Id: B4AZVVINBWT4.1T8A1MBARP1P2@Rok
MIME-Version: 1.0
Content-Type: multipart/alternative; boundary="=-CXTofpVZkZ2ZpmOk5gu3fQ=="
X-Antivirus: avast! (VPS 151007-1, 07.10.2015), Outbound message
X-Antivirus-Status: Clean
--=-CXTofpVZkZ2ZpmOk5gu3fQ==
Content-Type: text/plain; charset=utf-8
Hey Alice,
What are you up to this weekend? Monica is throwing one of her parties on
Saturday and I was hoping you could make it.
Will you be my +1?
-- Joey
--=-CXTofpVZkZ2ZpmOk5gu3fQ==
Content-Type: text/html; charset=utf-8
Content-Id: P053WVINBWT4.6J52K8AU0HP12@Rok
Hey Alice
--=-CXTofpVZkZ2ZpmOk5gu3fQ==--
DKIM Signature validation:
DKIM Information:
DKIM Signature
Message contains this DKIM Signature:
DKIM-Signature: v=1; a=rsa-sha256; d=dev.postar.eu; s=postar1024;
c=relaxed/relaxed; t=1444223643; h=from:to:subject:date:message-id;
bh=YFTLzdVcmulRq0rD7JHqdnjql/4m85WwE3/c73oFChw=;
b=Lauijgc+6haOkOfEsxpEO2VggdplHNM+o9jRlslyr6AmZnqmnfdy/oIaFpF5l4UD7VnugXZ3Yec
C9zfbrkHBSWZ17NtdLkk4SuCoLgkXA1e6XBiqKjFaDxpvbd4FXjUQYVgZ0/1dHS1Nf9zrTHes1/Pg
suCrbCWRWZhnShtdtj0=
Signature Information:
v= Version: 1
a= Algorithm: rsa-sha256
c= Method: relaxed/relaxed
d= Domain: dev.postar.eu
s= Selector: postar1024
q= Protocol:
bh= YFTLzdVcmulRq0rD7JHqdnjql/4m85WwE3/c73oFChw=
h= Signed Headers: from:to:subject:date:message-id
b= Data: Lauijgc+6haOkOfEsxpEO2VggdplHNM+o9jRlslyr6AmZnqmnfdy/oIaFpF5l4UD7VnugXZ3Yec
C9zfbrkHBSWZ17NtdLkk4SuCoLgkXA1e6XBiqKjFaDxpvbd4FXjUQYVgZ0/1dHS1Nf9zrTHes1/Pg
suCrbCWRWZhnShtdtj0=
Public Key DNS Lookup
Building DNS Query for postar1024._domainkey.dev.postar.eu
Retrieved this publickey from DNS: v=DKIM1;p=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC4j/gLQVfpgJFtoflMnVS77zZq+EIC2mmZUN/rSyRTx2B4Q16/YLDy39AvL+A05gIpXR5DCJnga1h6345aVVQ6ktB1lyA+oJ4gacOswPdIgcWgSb+4d/1eJzICSmeAEwghV5SXx4WkWO8Js8ZVIjrH2l1e0fJGI30c7TmxJZ8s2wIDAQAB
Validating Signature
result = fail
Details: body has been altered
Example code:
The text was updated successfully, but these errors were encountered: