What is DKIM?
DKIM (DomainKeys Identified Mail) is the email authentication protocol that proves a message was signed by a specific domain using public-key cryptography. Unlike SPF, which validates the sending server's IP address, DKIM validates the message content itself — proving that the headers and body were not altered after the message left the signing system.
DKIM is mandatory for Google and Yahoo bulk sender compliance as of 2024 (5,000+ emails/day) and is a critical prerequisite for DMARC enforcement. Without valid DKIM, DMARC must rely entirely on SPF alignment, which breaks for forwarded email. Together, SPF, DKIM, and DMARC form the complete email authentication stack.
Find your DKIM record: Run a free DKIM lookup on any selector →
How DKIM works (sign → publish → verify)
The DKIM protocol follows a three-phase flow:
1. Signing (sender side):
The mail platform selects which headers to include in the signature (typically From, To, Subject, Date) and computes a cryptographic hash. This hash is then encrypted with the domain's private key, producing the digital signature. The signature and metadata are added as a DKIM-Signature header to the message.
2. Publishing (DNS):
The corresponding public key is published at selector._domainkey.yourdomain.com as a DNS TXT record. This record is public and accessible to any receiver.
3. Verifying (receiver side):
The receiving MTA reads the d= and s= tags from the DKIM-Signature header, fetches the public key from DNS, reconstructs the same canonical hash of the specified headers and body, and decrypts the signature to verify they match. If the hash matches, DKIM passes. If any signed header or the body was modified in transit, the hashes diverge and DKIM fails.
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=example.com;
s=google; h=from:to:subject:date;
bh=2jUSOH9NhtIJPXFl5e0MHSkhRyeIFwRnfVWQbHlnmL4=;
b=AuUoFEfDxTDkHs54XFSEBmXH...
DKIM selectors explained
Selectors allow one domain to publish multiple DKIM keys simultaneously. The selector s= tag in the DKIM-Signature header tells the receiver which key to look up. This design enables:
- Multi-provider signing: Google Workspace uses
s=google, SendGrid usess=s1, each with their own key - Safe key rotation: Publish a new selector, switch signing, retire old selector — no downtime
- Traffic isolation: Different mail streams (transactional vs marketing) can use different signing keys
Good selector naming reflects ownership: google, sendgrid, mailchimp, s1-2025 are all better than selector1 shared across everything. When you are rotating keys or debugging authentication issues, clear selector naming tells you immediately which provider owns which key.
Key strength: 1024-bit vs 2048-bit DKIM keys
| Key Type | Status | Recommendation | |----------|--------|---------------| | 1024-bit RSA | Legacy | Migrate away — increasingly vulnerable | | 2048-bit RSA | Current standard | Use for all new configurations | | Ed25519 | Modern, preferred | Use where provider and DNS support it |
RFC 8301 (2018) deprecated 1024-bit DKIM keys and raised the minimum recommendation to 2048-bit. 1024-bit RSA keys are still present in many legacy mail deployments because providers never forced an upgrade. The practical risk: 1024-bit RSA can be factored by well-resourced attackers using distributed computing — making historical signed messages potentially forgeable.
DNS character limit note: 2048-bit RSA public keys generate very long base64 strings that often exceed the 255-character DNS TXT record limit. The key must be split across multiple quoted strings in the DNS record. Some DNS providers handle this automatically; others require manual splitting. A truncated key causes DKIM validation to fail silently.
DKIM rotation best practices
Key rotation is where mature DKIM programs separate from checkbox deployments. The most common failures:
- Deleting the old selector too early — receivers that cached the old key (TTL may be 24-48 hours) suddenly see missing keys and fail validation for in-flight messages
- Forgetting which provider owns which selector — undocumented selectors become orphaned in DNS and are never cleaned up
- Rotating without testing — new selector is published but signing platform is not updated, so old selector keeps signing but is not updated with the new key
Safe rotation sequence:
- Generate new key pair (new selector name, e.g.,
google-2026) - Publish new public key at
google-2026._domainkey.example.com - Wait 48 hours for propagation
- Update mail platform to sign with
s=google-2026 - Send test email — verify new selector in DKIM-Signature header
- Wait 24-48 hours
- Remove old selector DNS record
- Update internal documentation
Common DKIM failures and how to debug them
dkim=fail (signature verification failed): The cryptographic signature does not match. Most common causes: mail gateway added or modified content after signing (added footer, changed encoding), the DNS public key does not match the private key currently used for signing, or the key was copy-pasted with characters missing.
dkim=fail (no key for signature): The selector referenced in s= does not exist in DNS. Either the DNS record was never published, was deleted prematurely, or is published at the wrong name.
dkim=neutral or dkim=none: No DKIM signature was found in the message. The sending platform is not configured to sign, or is signing with a selector for a different domain.
Forwarding failures: Forwarders rewrite content after signing. Use c=relaxed/relaxed canonicalization (normalizes minor whitespace differences) rather than c=simple/simple (requires exact byte match) to reduce forwarding breakage. For mailing lists and complex forwarding, ARC is the appropriate solution.
DKIM and DMARC alignment
DKIM by itself proves that a domain signed the message. DMARC requires that the signing domain aligns with the visible From header domain. A message signed with d=sendgrid.net does NOT satisfy DMARC alignment for from:@yourcompany.com — because the signing domain and From domain are completely different.
This is why DMARC requires domains to configure their email providers to sign DKIM with your domain (e.g., d=yourcompany.com), not the provider's own domain. For example, Google Workspace signs with your domain by default. Some marketing platforms require configuring custom DKIM signing to align with your From domain.
Technical Architecture
DKIM uses public-key cryptography at the MTA level:
- Hash Generation: The sending MTA canonicalizes specified headers and body, then computes a SHA-256 hash.
- Signature Creation: The hash is encrypted with the domain's RSA private key, producing the
b=value in DKIM-Signature. - Public Key Retrieval: Receiving MTA reads
d=ands=, fetches public key fromselector._domainkey.domain.com. - Verification: Receiving MTA decrypts the signature using the public key and recomputes the hash from the received message.
- Match Check: If hashes match, DKIM passes. If headers or body were modified, hashes diverge and DKIM fails.
s1._domainkey.cyberfurl.com. IN TXT "v=DKIM1; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA..."
Common Misconfigurations
- Strict canonicalization (
c=simple/simple): Any whitespace normalization by gateways breaks the signature. Always usec=relaxed/relaxed. - 1024-bit RSA keys: Legacy keys with insufficient security strength — migrate to 2048-bit
- DNS record truncation: 2048-bit keys often exceed the 255-character DNS limit and must be split across multiple quoted strings
- Stale orphaned selectors: Old DKIM selectors left in DNS after provider migration can be exploited for replay attacks
Security Risks
- Message Tampering: Without DKIM, an adversary-in-the-middle can modify invoice amounts, routing numbers, or instructions in transit — undetectable to the recipient
- Domain Impersonation: While SPF protects the envelope, DKIM ensures that forwarded mail retains its authentication — protecting the domain from impersonation in forwarding chains
- Replay Attacks: Captured DKIM-signed emails can sometimes be replayed to other targets if the
x=expiry tag is missing and headers are not tightly scoped
Compliance Impact
- Google and Yahoo (2024 mandate): DKIM authentication required for all bulk senders — failure causes hard bounces
- NIST SP 800-177: Federal email trustworthiness standard requires DKIM for message integrity and non-repudiation
- HIPAA Security Rule: DKIM helps ensure that PHI transmitted via email has not been altered in transit
Best Practices for DKIM in 2025/2026
- 2048-bit RSA minimum — never generate new 1024-bit keys; migrate all legacy infrastructure
- Use
c=relaxed/relaxed— ensures signatures survive benign modifications by gateways and forwarders - Rotate keys every 6-12 months — treat key rotation as routine, not emergency
- Document selector ownership — map every selector in DNS to the provider and team that owns it
- Include DKIM in onboarding for new ESPs — establish DKIM signing requirements before any new mail provider goes live
Tools to check your DKIM
Use the CyberFurl DKIM lookup as your primary DKIM record checker. A DKIM lookup tool lets you query any selector for any domain to confirm the public key is present, syntactically valid, and not truncated. For debugging DKIM failures on live mail, inspect the raw headers of received messages and compare the d= and s= values to what is published in DNS. Combine the live checker with Email Security monitoring for continuous validation across all your signing selectors.
How CyberFurl Helps
Automated monitoring. Zero manual work.
CyberFurl continuously monitors DKIM health across all your signing domains and selectors. The platform automatically detects weak 1024-bit keys, identifies invalid or truncated DNS records, and alerts on DKIM alignment failures visible in DMARC aggregate reports - giving security teams the confidence to advance DMARC enforcement without disrupting critical business communications.
