How DKIM works

DKIM is defined in RFC 6376. When a message leaves your sending service, the server computes a hash of the body and of a chosen set of headers (always including From:), signs that data with the domain’s private key, and adds the result as a DKIM-Signature header:

DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=example.com;
  s=s1; h=from:to:subject:date:message-id; bh=...; b=...

The important tags are d= (the signing domain), s= (the selector), h= (the signed headers), bh= (the body hash), and b= (the signature itself). The receiving server reads d= and s=, fetches the public key from DNS at s1._domainkey.example.com, recomputes the hashes, and checks the signature. If everything matches, DKIM passes for example.com.

The public key record looks like this:

s1._domainkey.example.com.  TXT  "v=DKIM1; k=rsa; p=MIIBIjANBgkqh..."

Many providers ask you to publish a CNAME at the selector name instead, pointing to a key they host. That lets the provider rotate keys without you editing DNS each time.

What a DKIM selector is

The selector is an arbitrary label, such as google, s1, or a provider-specific string, that lets one domain publish many public keys at once. Each sending service signs with its own selector, so DKIM setup instructions always ask you to add a record at a specific selector._domainkey name rather than one fixed location the way SPF does.

Canonicalization: why signatures break

Mail servers sometimes make small changes to messages in transit, such as rewrapping long header lines or adjusting whitespace. DKIM’s canonicalization setting (c=) controls how tolerant the signature is. simple requires an almost exact match, while relaxed normalizes whitespace and header case before hashing. Most senders use relaxed/relaxed.

Changes that alter content will still break the signature. Mailing lists that add a subject prefix or footer, security gateways that rewrite links, and forwarding services that modify the body are common causes. The ARC protocol (RFC 8617) lets intermediaries record the authentication results they saw before making changes, which some receivers take into account.

DKIM vs SPF

SPF proves “this IP address is allowed to send for this envelope domain.” DKIM proves “this domain signed this message, and the signed parts are unchanged.” They fail independently. Forwarded mail usually fails SPF, because the forwarder’s IP isn’t in your record, but often keeps a valid DKIM signature. That makes DKIM the more durable of the two, and it’s why DMARC passes if either one passes with alignment.

Why DKIM matters

DKIM is a requirement for bulk senders. Google’s sender guidelines require senders of more than 5,000 messages a day to Gmail accounts to set up both SPF and DKIM, and Yahoo publishes matching requirements. A DKIM signature on your own domain also gives mailbox providers a stable identity to attach reputation to, independent of which IP addresses or ESPs you use. Mail signed only by your ESP’s shared domain builds reputation for the ESP, not for you.

How to set up DKIM correctly

  1. Sign with your own domain. In each sending platform, enable custom DKIM so that d= is your domain (or a subdomain of it) rather than the provider’s default.
  2. Publish the records exactly as given. Copy TXT or CNAME values carefully. Long keys are sometimes split into multiple quoted strings in DNS, which is normal.
  3. Use strong keys. Prefer 2048-bit RSA. RFC 8301 states that rsa-sha1 must not be used for signing.
  4. Send a test and read the headers. Look for dkim=pass with your domain in the Authentication-Results header of a delivered message.
  5. Rotate and clean up. Rotate keys periodically and remove selectors for services you’ve stopped using, so old keys can’t be misused.

Where RocketVerifier helps

The free email deliverability checker confirms your domain’s SPF, DKIM, and DMARC records are published and readable. Authentication earns trust, and a clean list keeps it: bulk email verification removes invalid and risky addresses so bounces don’t erode the reputation your DKIM domain is building.