DKIM Authentication: Verify Signatures and Manage Keys
A company’s messages reach recipients, but some arrive with a failed signature after a mail service change. The first task is to identify the signer and selector, check the published public key, and compare the receiver’s result with the message’s actual path. Authentication using DKIM is a chain of related operations, not a single DNS switch.
DKIM authentication associates a signing domain with a message using a cryptographic signature. The receiving system can verify that signature using a public key published by the signer. A valid signature says something about the signed content and domain; it does not promise inbox delivery or establish that every visible address belongs to the signer.
From signature to DNS key
A signing service uses a private key to create a signature over selected message headers and a hash of the body, subject to the signature’s stated rules. It adds a DKIM-Signature header containing, among other information, the signing domain in d= and a selector in s=. The private key stays under the signer’s control; it is not published in DNS or shared in support tickets.
The receiver uses the domain and selector to locate the corresponding public key. For a fictional signer example.com and selector mail1, the lookup name is mail1._domainkey.example.com. The TXT record at that name carries public verification material. The example is illustrative and does not require a live lookup. The DKIM specification, RFC 6376, published in 2011, describes this signing and verification process.
The recipient checks the signature and the signed message data using that key. Mail systems can change content in transit, and certain modifications can invalidate a signature. Canonicalization rules permit some changes, but they do not guarantee that every transformation will preserve verification. A DKIM signature may cover selected headers and, depending on its parameters, only a specified portion of the body; its scope should not be overstated.
Understand what a result means
A pass indicates that a particular signature verified for its signing domain under the receiver’s evaluation. A message may have more than one signature, each with its own domain and result. A failed or missing signature calls for diagnosis, but the recipient decides how to treat the message based on its complete policy and other signals.
SPF answers a different question: whether the connecting host is authorized for an evaluated SMTP identity. DMARC can use an aligned passing DKIM signature or an aligned SPF result when evaluating the visible From domain. Therefore a valid signature from an unrelated domain does not by itself satisfy DKIM alignment for that From domain. Authentication of mail with DKIM should be reviewed together with the identity and alignment actually reported by the receiver.
Diagnose and rotate deliberately
For domain-level DKIM message authentication, inventory each legitimate sending service, its signing domain, selector, and responsible owner. Confirm that the expected public key is published at the correct name and that the service is signing with the corresponding private key. Review trusted receiving-system authentication results, signature headers, and message traces. A missing record, a wrong selector, temporary DNS trouble, or a change after signing can each lead to a different investigation.
For DKIM email authentication, plan key rotation as a controlled change. Create a new key through the authorized signing service, publish its public key under a new selector, and verify publication before switching signing to that selector. Keep the old public key available long enough for messages signed before the change to be verified, accounting for delivery and DNS caching. Protect private keys, restrict administrative access, and follow the provider’s supported key-handling process.
After the switch, send an approved test message through each affected mail stream and inspect the receiver’s signature result, signing domain, and selector. Monitor production results for unexpected failures, then retire the old key according to the approved schedule. This check makes DKIM authentication observable and keeps authentication through DKIM maintainable as senders change.