DKIM signatures explained: how email signing works

By the LeadsPaw team · Last updated

DKIM - DomainKeys Identified Mail - is how a domain takes cryptographic responsibility for an email. Per RFC 6376, it permits a person, role or organization to claim some responsibility for a message by associating a domain name with it, validated through a cryptographic signature and by querying the signer's domain directly for the public key. Here is what the signature contains, what a pass actually proves, and where selectors fit in.

How signing and verification work

The signer computes a hash over some or all of the message - selected header fields and the body - and attaches the result as a DKIM-Signature header field, prepended to the message like other trace headers. The signature tags carry the signing domain (d=) and a selector (s=). No certificate authority is involved: the RFC's design has the verifier request the public key directly from a repository in the signer's domain - the DNS - rather than from a third party.

Verification, per the RFC's own scoping, asserts exactly one thing: that the hashed content has not changed since it was signed. It asserts nothing else about "protecting" the end-to-end integrity of the message. A DKIM pass is a statement about the signature and the domain that made it - not a verdict that the email is legitimate, wanted or safe.

The d= domain and why it need not match the From address

DKIM deliberately separates the signer's identity from the message's purported author: the signing identity travels inside the signature, and the RFC states it is not required to match an address in any particular header field. An ESP can sign with its own domain while your address sits in the From: line, and the signature is still valid. Tying the signing domain to the visible From: domain is a separate check - DMARC's alignment - covered in the DMARC policies guide.

Selectors: many keys under one domain

A domain is not limited to one DKIM key. The key namespace is subdivided using selectors, and the RFC's examples include naming office locations or signing dates. That supports real operational needs the RFC lists: delegating signing capability to a partner such as an advertising provider for a given duration, or rotating keys over time - each key lives under its own selector, and the verifier uses the s= tag to fetch the matching public key from the signer's DNS.

Where DKIM sits next to SPF and DMARC

The three mechanisms check different things. SPF authorizes sending hosts through a DNS list; DKIM signs the message content itself; DMARC tells receivers what to do when a message fails and reports back what they saw. Google's sender guidelines ask bulk senders to run all three - the tiers are mapped in Gmail's bulk sender requirements, and the setup guide walks through the DNS records step by step.

Frequently asked questions

What does a passing DKIM signature actually prove?

One thing, per RFC 6376: the hashed content of the message has not changed since it was signed. The RFC is explicit that verification asserts that and nothing else about protecting the end-to-end integrity of the message.

Does the DKIM signing domain have to match the From: address?

No. RFC 6376 separates the identity of the signer from the purported author, and states the signing identity is not required to match an address in any particular header field. Tying the signing domain to the visible From: domain is what DMARC's alignment check adds on top.

What is a DKIM selector?

A label that subdivides a domain's DKIM key namespace, allowing multiple concurrent public keys under one domain. RFC 6376's examples include selectors naming office locations or signing dates - useful for delegating signing to a partner or rotating keys. The verifier uses the selector to find the right public key in the signer's DNS.

What is the difference between DKIM and SPF?

SPF authorizes sending hosts: the domain publishes a DNS list of permitted senders, and receivers check the connecting host against it. DKIM signs the message itself: a domain attaches a cryptographic signature, verified against a public key in its own DNS. They check different things, and DMARC builds a policy layer on top of both.