I'am trying to sign a message sent with SMTP commands (using telnet) with DKIM protocole , i applied in the official dkim website all the steps , it remains how i can calculate the 'b' parameter , should i validate it with the private key ? Or using another method? Thank you
相关问题
- Django & Amazon SES SMTP. Cannot send email
- How to add sender name before sender address in py
- TCL Email Script doesn't deliver in Activestat
- Is the SMTP virtual server deprecated in IIS 7?
- error while sending mail using javamail
相关文章
- c#发送邮件,附件损坏
- com.sun.mail.smtp.SMTPSenderFailedException: 550 5
- How to get the size of a RSA key in Java
- Outlook SMTPClient server error 5.3.4 5.2.0
-
553 5.7.1
: Sender address rejected: not - Sanity check SSH public key? [closed]
- Use RSA with Eclipse Remote Systems Explorer?
- Send email from my custom mailgun SMTP address
Unfortunatly it doesn't match with signature generated by PowerMta.
'b' generated by my signature :
The header after a test with PowerMta :
It's all explained in this document: https://www.ietf.org/rfc/rfc6376.txt
First, you must canonicalize the header fields that you wish to sign including the
DKIM-Signature
header that you are about to generate and then you sign it using the signature algorithm you've chosen.The "simple" Header Canonicalization Algorithm
The "simple" header canonicalization algorithm does not change header fields in any way. Header fields MUST be presented to the signing or verification algorithm exactly as they are in the message being signed or verified. In particular, header field names MUST NOT be case folded and whitespace MUST NOT be changed.
The "relaxed" Header Canonicalization Algorithm
The "relaxed" header canonicalization algorithm MUST apply the following steps in order:
Convert all header field names (not the header field values) to lowercase. For example, convert "SUBJect: AbC" to "subject: AbC".
Unfold all header field continuation lines as described in RFC5322; in particular, lines with terminators embedded in continued header field values (that is, CRLF sequences followed by WSP) MUST be interpreted without the CRLF. Implementations MUST NOT remove the CRLF at the end of the header field value.
Convert all sequences of one or more WSP characters to a single SP character. WSP characters here include those before and after a line folding boundary.
Delete all WSP characters at the end of each unfolded header field value.
Delete any WSP characters remaining before and after the colon separating the header field name from the header field value. The colon separator MUST be retained.
Canonicalizing the DKIM-Signature header
Once you've canonicalized all of the other headers that you wish to sign, you then need to apply the same canonicalization to the DKIM-Signature that you are in the process of generating.
Obviously, at this point you will not have the
b=
value yet because the result of signing the canonicalized headers is the value for theb=
tag.What you need to do is to construct the header but leave the
b=
tag empty.For example:
Signing the canonicalized headers
Once you've canonicalized all of the headers you want to sign (plus the portion of the DKIM-Signature header that you are generating), you need to sign the result using the algorithm and the private key (not public key!!) and then base64 encode the result and append it to the DKIM-Signature header you've generated.
In the above example, you would use the RSA-SHA256 algorithm.
Update:
If the original message headers that you want to sign look like this:
And if the DKIM-Signature header that PowerMTA generates looks like this:
Then the text you should be signing would look like this (assuming you want your
b=
value to match theb=
value that PowerMTA generates):Original Header :
Canonicalized header with DKIM-SIGNATURE :
RSA command to sign the content (header+Dkimsignature)
This is the new content to Sign :