The email delivery process involves various servers and processing systems. Verifying that a message maintains the integrity of its signed elements—and that the signature corresponds to the indicated domain—is one of the functions of the DomainKeys Identified Mail (DKIM) standard.
Unlike mechanisms based on the authorization of sending servers, DKIM uses cryptographic signatures to link a message to a domain, allowing the receiving server to verify that the protected components have not been altered since they were signed.
This mechanism adds an extra layer of capability to email authentication—a feature particularly relevant in infrastructures where messages pass through various services before reaching their final destination.
How a digital message signature works
DKIM uses asymmetric cryptography based on a key pair: a private key, used by the sending system to generate the signature, and a public key, published in the DNS of the corresponding domain.
When a message is sent, the server configured to sign it adds a DKIM-Signature header, which contains the information necessary to verify the signature.
Its parameters include the signing domain (d=), the key selector (s=), and the list of headers included in the signature (h=).
Example of a DKIM record in DNS
Illustrative example. The public key is shown in an abbreviated form.
The receiving server uses this data to locate the public key in the DNS and cryptographically verify the signature. If the verification is successful, it confirms that the signed parts of the message have not been altered in a way that would invalidate the signature.
A valid result confirms the cryptographic integrity of the protected elements and their association with the signing domain, but it does not guarantee that the content of the message is legitimate or safe.
Key Management as Part of Security
The effectiveness of DKIM does not depend solely on enabling message signing. The management of cryptographic keys is an essential element in maintaining the reliability of the mechanism.
Selectors allow for the association of different public keys with a single domain, facilitating their use across various sending systems and enabling their replacement when necessary.
For organizations that use external email platforms, this capability is particularly useful for managing different services without necessarily sharing the same private key.
From an operational perspective, several aspects should be considered:
- Protection of private keys: preventing unauthorized access that could allow for the generation of valid signatures on behalf of the domain.
- Key rotation: establishing procedures to replace keys without disrupting message validation.
- Review of selectors: identifying keys and configurations that are no longer in use.
- Error monitoring: detecting signing or verification failures associated with changes to email services.
An outdated configuration or inadequate key management can compromise the utility of DKIM, even when the mechanism is enabled.
What happens when a signed message is modified
One of the characteristics of DKIM is that certain modifications made during transit can invalidate the signature.
This can occur when an intermediary system alters the message body or modifies any of the protected headers. For example, some mailing lists may add extra content or change elements of an email before forwarding it.
The outcome depends on which parts of the message were signed and how the modification was carried out.
Therefore, a DKIM verification failure does not necessarily indicate malicious activity. It may instead be the result of legitimate changes introduced during the email's processing.
For cybersecurity teams, it is important to distinguish between these scenarios and to analyze authentication errors by considering the message's path and the systems involved in its delivery.
DKIM provides a verifiable guarantee regarding the integrity of signed elements and their association with a domain. Maintaining this capability requires proper key management, regular configuration reviews, and an understanding of how intermediary systems can affect message validation.