From RFC6376 #page-29, it says:
In hash step 1, the Signer/Verifier MUST hash the message body, canonicalized using the body canonicalization algorithm specified in the "c=" tag and then truncated to the length specified in the "l=" tag.
From Wikipedia DomainKeys Identified Mail, it says:
Both header and body contribute to the signature. First, the message body is hashed, always from the beginning, possibly truncated at a given length (which may be zero)...
- What's the default value of the
l=tag? Does the whole message body get hashed? If not the whole body message get hashed, then may an attacker modify the unhashed part of the body message and pass DKIM check?
From Wikipedia DomainKeys Identified Mail:
....No data integrity is implied.
From RFC6376 #section-1.5:
Verifying the signature asserts that the hashed content has not changed since it was signed and asserts nothing else about "protecting" the end-to-end integrity of the message.
- Why is it saying that DKIM doesn't ensure data integrity? Isn't "hashed content has not changed" == "data integrity"?
l=is not dynamically calculated in practice (Exchange does not). So, you are correct on that point, but your thought experiments on the reasons why don't hold water. a) Yes, one of the well-identified weaknesses is that if you setl, then only part of it gets signed. b) many MTAs are well-known to add to email bodies, so the default will get the email rejected, meaning that if you set it tol=0, which is what Exchange suggests, then the body is not checked at all. to provide some body hashing, then, yes, you sign only part. – schroeder Apr 26 '20 at 11:38l, you calculate automatically calculate the canonicalized length to the message body. – schroeder Apr 26 '20 at 11:39l, you calculate automatically calculate the canonicalized length to the message body.". Becasue whenever you give a value tol, you are giving a defined value tol, while the entire body is not a "defined value" as for the receiver. – Rick Apr 26 '20 at 12:03b)example of your comment. Exchange suggests settingl=0? I don't get it. Whatever, I am glad that we get this done.Cheers :P – Rick Apr 26 '20 at 12:07l=0and sign onlyMessage-IdandDate. That avoids all mail getting broken by old school mailing lists that prefix the subject or body with some list specific text. Spammers would need to re-useMessage-Idwith originalDateto reuse the signatures. If you want real security, you have to use S/MIME or OpenGPG instead. – Mikko Rantalainen May 09 '22 at 12:00