mirror of
https://github.com/KumoCorp/kumomta.git
synced 2026-09-10 16:01:29 +00:00
It was reported that AWS SES could mark the DKIM signature as failed when using a specific combination of headers in the header list, with specific lengths of the other fields. The reason for this is that we had two passes of wrapping applied to the header, and they might not agree on the formatting of the header. The solution is to remove the second pass and just take a bit more care to emit the header in a wrapped form in the first instance, that way there can be no discrepancy or conflict. closes: https://github.com/KumoCorp/kumomta/pull/483
kumo-dkim
DKIM (RFC6376) implementation
Features
Verifying email signatures
Example:
let res: DKIMResult = kumo_dkim::verify_email(&from_domain, &parsed_email).await?;
if let Some(err) = &res.error() {
error!(logger, "dkim verify fail: {}", err);
}
println!("dkim={}", res.with_detail());
Signing an email
Example:
let private_key =
rsa::RsaPrivateKey::read_pkcs1_pem_file(Path::new("./test/keys/2022.private"))?;
let signer = SignerBuilder::new()
.with_signed_headers(["From", "Subject"])?
.with_private_key(private_key)
.with_selector("2020")
.with_signing_domain("example.com")
.build()?;
let signature = signer.sign(&email)?;
println!("{}", signature); // DKIM-Signature: ...
See the SignerBuilder object documentation for more information.
Generate a test DKIM key
Using OpenDKIM:
opendkim-genkey \
--testmode \
--domain=example.com \
--selector=2022 \
--nosubdomains