DKIM ([RFC6376]) implementation
Example: ```rust let res: DKIMResult = cfdkim::verifyemail(&logger, &fromdomain, &parsed_email).await?;
if let Some(err) = &res.error() { error!(logger, "dkim verify fail: {}", err); }
println!("dkim={}", res.with_detail()); ```
The verify_email
arguments are the following:
- logger
: [slog]::Logger
- from_domain
: &str ([RFC5322].From's domain)
- parsed_email
: [mailparse]::ParsedMail
Example: ```rust let privatekey = rsa::RsaPrivateKey::readpkcs1pemfile(Path::new("./test/keys/2022.private"))?;
let signer = SignerBuilder::new() .withsignedheaders(&["From", "Subject"])? .withprivatekey(privatekey) .withselector("2020") .withlogger(&logger) .withsigning_domain("example.com") .build()?; let signature = signer.sign(&email)?;
println!("{}", signature); // DKIM-Signature: ... ```
See the SignerBuilder object documentation for more information.
Using [OpenDKIM]:
opendkim-genkey \
--testmode \
--domain=example.com \
--selector=2022 \
--nosubdomains