DKIM stands for DomainKeys Identified Mail. It is a method for email authentication. It allows a domain owner to take responsibility for a message by using cryptographic signatures. The sending mail server signs the message headers with a private key. The receiving mail server checks the signature using a public key published in DNS.
The purpose of DKIM is to verify that an email message was not changed after it left the sender and that the message truly comes from the claimed domain. It helps fight email spoofing and phishing attacks.
The idea behind DKIM (DomainKeys Identified Mail) evolved from two earlier initiatives:
These efforts were merged and standardized by the Internet Engineering Task Force (IETF). The result was the first official version of DKIM, published as RFC 4871 in May 2007.
Before DKIM, email systems relied on simple protocols such as SMTP. They lacked several important features we now take for granted:
This left email vulnerable to abuse:
DKIM introduced cryptographic signing to email:
In 2011, the IETF released RFC 6376, which:
DKIM remains a foundational tool in securing modern email communication and protecting domain reputation.
The DKIM system uses a public and private key pair. The private key stays on the sending mail server. The public key is placed in the domain’s DNS records.
When a mail server sends an email:
When the receiving mail server gets the email:
The receiving server can then decide how to treat the message. It might mark it as spam, reject it, or accept it depending on the result and other factors.
The DKIM-Signature header includes several tags:
An example DKIM header looks like this:
DKIM-Signature: v=1; a=rsa-sha256; d=example.com; s=mail2025;
h=from:subject:date:to;
bh=F0Y2...Xw=;
b=MEUCIQDX...IDAQAB
The selector is a string that helps locate the public key. It allows domain owners to rotate or manage keys without changing the domain.
For example, if the selector is mail2025, the public key DNS record would be at:
mail2025._domainkey.example.com
That DNS record contains a text entry with the public key:
v=DKIM1; k=rsa; p=MIGfMA0GCSqGSIb3...
The v=DKIM1 confirms the DKIM version. The k=rsa tells the algorithm. The p= field holds the public key itself.
DKIM protects only the parts of the message it signs. Usually, this includes headers like From, To, Subject, and Date. It may or may not include the message body, depending on configuration.
If a mail transfer agent modifies a message after signing, the DKIM check will fail. For example, some mailing lists add footers or change subject lines. These changes break the signature unless the system is configured to ignore those fields or use relaxed canonicalization.
DKIM and SPF (Sender Policy Framework) both help verify email. They work in different ways.
Feature | DKIM | SPF |
Based on | Message contents | IP address of sending server |
Uses DNS | Yes | Yes |
Signs content | Yes | No |
Can survive forwarding | Yes | No |
Affects body | Yes | No |
Common failures | Header changes, body edits | Email forwarding |
DKIM stays valid through forwarding as long as the body and headers do not change. SPF usually fails if the message passes through an unapproved server.
DKIM becomes more useful when used with DMARC (Domain-based Message Authentication Reporting and Conformance). DMARC checks that the DKIM signature is valid and that the domain in the From header matches the domain in the DKIM signature.
Without DMARC, DKIM gives a pass or fail result. With DMARC, the domain owner can publish a policy that tells receivers what to do with failed messages. It can also request reports that help monitor spoofing attempts.
A valid DKIM signature that aligns with the From domain contributes to a pass under DMARC.
DKIM does not stop spam. A spammer can sign messages with their own domain. DKIM only proves who sent it, not whether it is wanted.
DKIM also fails if the email content changes. Some legitimate servers change subject lines or footers. These changes break the signature unless the configuration accounts for it.
DNS records must be public. This can expose key management details. Keys must be rotated and protected like any other security asset.
Keys must be long enough to resist attacks. Most domains now use 2048-bit RSA keys. Shorter keys, like 512-bit or 1024-bit, are no longer safe.
Domains should rotate keys often. This helps limit damage if a key leaks. Rotating keys involves publishing a new selector and updating the sending system.
It is common to use a separate selector for each mail system. This makes it easier to manage keys and isolate systems.
DKIM is used by:
Most large providers now check DKIM. Gmail shows a "signed by" line in its interface if the check passes. Many services reject unsigned or failed messages if DMARC is in place.
DKIM is also required by some security programs. Starting in 2024, Gmail and Yahoo began requiring DKIM or SPF for bulk senders. This change aims to reduce fraud and phishing.
NTC Hosting supports DKIM across its range of Hepsia Panel-powered hosting services - web hosting, VPS, semi-dedicated servers, and dedicated servers. This support enables users to enhance their email security by implementing DKIM signatures for outgoing emails.
By utilizing DKIM, users can ensure that their emails are authenticated and trusted by recipients, thereby improving deliverability and protecting their domain reputation.