DKIM Cryptography: RFC 8301 RSA Requirements and RFC 8463 Ed25519-SHA256

· Published · 12 min read

DKIM cryptography transition from prohibited RSA-SHA1 and weak keys to RSA-SHA256 and Ed25519-SHA256 with separate selectors

RFC 8301 removed RSA-SHA1 from DKIM use, raised RSA key requirements and made RSA-SHA256 the required baseline. RFC 8463 later added Ed25519-SHA256 as an additional DKIM algorithm with much smaller DNS public keys. The safe deployment path is not an immediate RSA replacement: keep compliant RSA-SHA256, add Ed25519 with a separate selector, verify both independently and retire algorithms only when receiver evidence supports the decision.

Two different DKIM cryptography changes in 2018

RFC 8301 was published in January 2018. It updated RFC 6376 by prohibiting rsa-sha1 for both signing and verification, requiring RSA signing keys of at least 1024 bits and recommending at least 2048 bits. Verifiers must support RSA keys from 1024 through 4096 bits and must not treat a signature below 1024 bits as valid.

RFC 8463 was published in September 2018. It added Ed25519-SHA256 to DKIM. It did not make RSA-SHA256 historic and did not say every sender should immediately sign only with Ed25519. The transition section explicitly supports multiple signatures for backward compatibility.

Normative requirements translated into operations

RequirementRFC 8301 or RFC 8463 ruleSender implementationVerifier interpretation
RSA-SHA1RFC 8301 says rsa-sha1 MUST NOT be used for signing or verification.Remove rsa-sha1 from every signing profile.Treat a signature using the historic algorithm as a permanent evaluation failure.
RSA-SHA256Signers MUST use and verifiers MUST support rsa-sha256.Keep rsa-sha256 as the interoperability baseline.Verify with the published RSA key and ordinary DKIM processing.
RSA key sizeSigners MUST use at least 1024 bits and SHOULD use at least 2048 bits.Generate 2048-bit or stronger keys that fit operational DNS and signer limits.Keys below 1024 bits cannot produce a valid result; verifiers must support 1024 through 4096 bits.
Ed25519-SHA256RFC 8463 says signers SHOULD implement and verifiers MUST implement it.Add it with a separate selector after software and provider testing.Evaluate it independently from any RSA signature.
Multiple signaturesRFC 6376 and RFC 8463 permit transition through multiple signatures.Apply RSA and Ed25519 signatures to the same final message during migration.A failed or unsupported signature does not cancel a separate valid signature.

Cryptographic validity is not DMARC alignment

DKIM verification answers whether the selected headers and body hash verify under the public key at s._domainkey.d. DMARC separately asks whether a passing DKIM signature’s d= domain aligns with the visible RFC 5322 From domain. A cryptographically valid third-party signature may not be aligned, and an aligned signature can still fail because content changed.

Record algorithm, selector, signing domain and alignment separately. Do not collapse “DKIM pass” and “DMARC pass” into one badge, and do not infer that a stronger algorithm repairs an unaligned signing domain.

Implementing compliant RSA-SHA256 signing

Use a new selector and a private key generated on a controlled host or managed key service. RFC 8301 permits 1024-bit signing but recommends at least 2048 bits. A 2048-bit key is the normal interoperability baseline. Larger RSA keys increase DNS size and signing cost and should be tested against signer, DNS provider and receiver limits.

The following OpenDKIM example generates a 2048-bit key. Paths, ownership and signer integration must be adapted to the actual deployment. Never paste a private key into DNS or a ticket.

# Generate a 2048-bit RSA selector with OpenDKIM tooling.
install -d -m 0700 /etc/opendkim/keys/example.com
cd /etc/opendkim/keys/example.com
opendkim-genkey -b 2048 -d example.com -s rsa2026
chmod 0600 rsa2026.private

# Files normally produced:
# rsa2026.private  -> private signing key; never publish it
# rsa2026.txt      -> DNS TXT record containing the RSA public key

# Inspect the public key size from the private key.
openssl pkey -in rsa2026.private -text -noout | head

# Publish at this owner name:
# rsa2026._domainkey.example.com TXT "v=DKIM1; k=rsa; p=<BASE64-PUBLIC-KEY>"

Publish long RSA public keys correctly

A 2048-bit RSA DKIM public key often exceeds one 255-octet DNS character-string. DNS permits a TXT record to contain multiple quoted strings, and DKIM concatenates them without inserted whitespace. The DNS control panel may split the value automatically or require explicit chunks.

There must be one DKIM key record at a selector owner. Publishing multiple independent TXT records at the same selector produces undefined results. A TXT record used for another purpose should not share that exact selector owner.

Implementing Ed25519-SHA256 signing

RFC 8463 uses PureEdDSA Ed25519 to sign the DKIM SHA-256 message hash. The DNS key record uses k=ed25519, and p= contains the raw 32-byte Ed25519 public key encoded as 44 Base64 octets. It is not an RSA SubjectPublicKeyInfo blob and must not be labelled k=rsa.

Confirm that the actual DKIM signer, not merely the operating system crypto library, supports a=ed25519-sha256. The following OpenSSL sequence is useful for controlled key generation and independent public-key inspection, but the signer’s documented import or generation process remains authoritative.

# Generate an Ed25519 private key only when the selected signer supports
# RFC 8463 DKIM signing and its required key format.
openssl genpkey -algorithm ED25519 -out ed2026.private.pem
chmod 0600 ed2026.private.pem

# Extract the final 32-byte raw Ed25519 public key from OpenSSL SPKI DER
# for an independent laboratory check, then encode it as one Base64 line.
openssl pkey -in ed2026.private.pem -pubout -outform DER \
  | tail -c 32 \
  | openssl base64 -A

# The resulting p= value is 44 Base64 octets for a 256-bit public key.
# Publish with a separate selector:
# ed2026._domainkey.example.com TXT "v=DKIM1; k=ed25519; p=<44-CHAR-BASE64>"

# Do not assume that software supporting Ed25519 TLS or SSH also supports
# RFC 8463 DKIM. Use the signing product's documented DKIM key import.

RSA and Ed25519 DNS record examples

rsa2026._domainkey.example.com. 300 IN TXT (
  "v=DKIM1; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A"
  "MIIBCgKCAQEA...REMAINDER-OF-RSA-PUBLIC-KEY...IDAQAB" )

ed2026._domainkey.example.com. 300 IN TXT (
  "v=DKIM1; k=ed25519; p=<44-CHARACTER-BASE64-PUBLIC-KEY>" )

Rules:
- The quoted RSA chunks form one TXT record and concatenate without spaces.
- Each selector owner has exactly one DKIM key TXT record.
- RSA and Ed25519 use different selectors and different k= values.
- Example placeholders must be replaced with generated public keys.

Query the final public DNS answer after publication, concatenate all returned strings and Base64-decode p=. Verify that the RSA key size or Ed25519 32-byte length matches the private key inventory before enabling signing.

Dual signing is the compatibility migration

During migration, apply both an RSA-SHA256 signature and an Ed25519-SHA256 signature to the same final message. Use separate selectors because each DNS key record declares one key type. Receivers supporting Ed25519 can verify it, while receivers lacking support can still verify RSA.

Generate both signatures after all content-changing filters. A downstream footer, subject rewrite, MIME conversion or line-ending change can break one or both signatures depending on canonicalization and signed headers. Dual signatures do not protect against modifications that invalidate both.

Illustrative dual-signature headers

DKIM-Signature: v=1; a=rsa-sha256; d=example.com; s=rsa2026;
 c=relaxed/relaxed; h=from:to:subject:date:message-id:mime-version:
 content-type; bh=<BODY-HASH>; b=<RSA-SIGNATURE>

DKIM-Signature: v=1; a=ed25519-sha256; d=example.com; s=ed2026;
 c=relaxed/relaxed; h=from:to:subject:date:message-id:mime-version:
 content-type; bh=<BODY-HASH>; b=<ED25519-SIGNATURE>

The order of these headers carries no policy meaning. A verifier evaluates
each supported signature independently using its own selector and key.

Evaluate every signature independently

RFC 6376 does not assign policy meaning to DKIM-Signature header order. Relays can reorder headers. A verifier can process signatures in any order and should continue until a signature satisfies its policy, subject to resource limits. One bad signature does not cryptographically invalidate a separate good signature.

Tools should report one row per signature: algorithm, d=, s=, identity, canonicalization, signed headers, body-hash result, key lookup result, key size, signature result and DMARC alignment. “DKIM: pass” without identifying the passing signature hides migration failures.

Selectors are key namespaces, not algorithms

The selector from s= and signing domain from d= form the DNS owner s._domainkey.d. A selector can encode a date, provider or purpose, but its name does not prove any property. The DNS record’s k= and the signature’s a= establish algorithm compatibility.

Use immutable selectors for key generations. Do not replace public-key material under one selector during rotation because cached DNS can cause unpredictable verification. Publish a new selector, wait, switch signing, observe, and retire the old selector later.

Key rotation and delayed-message safety

1. Generate a new private key under a new selector.
2. Publish the new selector and verify the complete DNS TXT value.
3. Wait for authoritative and recursive DNS propagation.
4. Configure the signer to use the new selector.
5. Verify received copies at multiple mailbox providers.
6. Stop signing with the old selector only after new evidence is stable.
7. Retain the old public key while delayed messages can still be verified.
8. Revoke with an empty p= or remove according to the incident/runbook need.
9. Delete retired private material through the controlled key process.

Retention time for an old public key should account for DNS TTL, retry queues, delayed delivery, forwarding and archived samples that operations may still need to verify. Removal and an empty p= revocation are not operationally identical; define which action the incident procedure uses.

Sign only after the message is final

DKIM hashes selected headers and the canonicalized body. The signer should run after content assembly, list-unsubscribe insertion, tracking rewrite, MIME encoding and compliance footers. Any later component that changes signed material can create a body-hash or header-signature failure.

Document the exact mail flow. Test direct delivery, list expansion, forwarding, gateway disclaimers and each outbound provider. ARC may preserve intermediary authentication assertions, but it does not make a broken DKIM signature pass.

Choose signed headers deliberately

At minimum, sign identity and message fields needed for trustworthy interpretation, including From. Repeated header fields and oversigning require careful RFC 6376 handling. The h= list is ordered and can contain repeated field names. A generic set copied from another platform may omit fields that matter to the program or sign fields a gateway later changes.

Use a consistent canonicalization policy. Relaxed canonicalization tolerates defined whitespace changes but does not tolerate arbitrary content rewriting. Record c= in evidence and diagnose failures against the exact received message.

Validate DNS as DKIM sees it

Query TXT at the complete selector owner through multiple resolvers. Confirm one RR, correct concatenation, no smart quotes, no copied parentheses in hosted-DNS values and no truncation. Decode p= and compare it with the intended public key.

DNSSEC can authenticate the DKIM key response when deployed, but DKIM does not require DNSSEC for ordinary operation. DNSSEC does not correct a wrong key, selector or algorithm tag. Report DNSSEC state separately from DKIM verification.

Verify received copies, not only source messages

Send controlled messages to representative mailbox providers and retrieve complete raw messages. Confirm both DKIM-Signature headers survived, then inspect trusted Authentication-Results and independently verify where possible. A local signer log proves signing was attempted, not that the receiver obtained a valid signature.

Collect RSA and Ed25519 results separately. Some receivers may ignore an unsupported algorithm without reporting failure. Absence of an Ed25519 result is not automatically a pass or fail; it is an observation that needs provider and parser context.

Control keys used by ESPs and delegated signers

An email service provider can sign with the customer domain only when the customer publishes or delegates a selector that leads to the provider’s public key. Inventory every delegated selector, provider account, authorized From domain and contract owner. Removing an unused selector or its DNS delegation is part of terminating signing authority.

Do not reuse one private key across unrelated customers, environments or vendors. Separate production from testing, separate organizational domains where incident boundaries require it, and keep selector ownership visible in the DNS and internal inventory. Provider-generated keys still need algorithm, size, creation date, rotation and revocation evidence.

Protect the signing keys, not only the DNS records

The public DNS record can be copied safely; the private key cannot. Store private material with restrictive permissions or in a signer-supported key-management service. Limit export, record administrative access and prevent application users from downloading keys. Backups must receive equivalent controls.

A leaked DKIM private key lets an attacker create cryptographically valid signatures for the signing domain until the selector is revoked. The incident runbook should stop signing, publish revocation or remove the key record as appropriate, activate a prepared selector, search logs for unauthorized use and assess DMARC-aligned abuse.

Evidence model for a DKIM cryptography audit

EvidenceWhat to recordUseful conclusionUnsafe conclusion
DNS key recordOwner name, TXT strings after concatenation, k= value, decoded public-key length, TTL and lookup time.The selector published a syntactically usable key at that observation time.The private key is secure or messages are being signed correctly.
DKIM-Signature headera=, d=, s=, c=, h=, bh=, b=, t=, x= and message capture boundary.The message claims a specific signing algorithm, domain and selector.The signature passed without cryptographic verification.
Trusted Authentication-Resultsauthserv-id, per-signature method result, header.d, header.s and reason.That trusted receiver evaluated each reported signature as stated.Every mailbox provider produced the same result.
Key inventoryPrivate-key owner, signer, selector, algorithm, size, created date, activation and retirement state.The organization can map live signatures to managed keys.A DNS selector alone proves custody or authorized use.
Received message sampleRaw headers and body exactly as received by the target mailbox.Canonicalization and transit behavior can be reproduced.A source message before transit proves destination verification.

Failures the implementation must detect

  • rsa-sha1 remains enabled on a legacy stream.
  • An RSA signing key is below 1024 bits.
  • A 2048-bit TXT value is truncated or split into multiple records.
  • Ed25519 public key contains SPKI wrapper bytes instead of the raw 32-byte key.
  • RSA and Ed25519 reuse one selector owner.
  • The signature algorithm and DNS k= type disagree.
  • A new selector is used before DNS propagation.
  • The old selector is removed while queued messages still reference it.
  • A downstream gateway changes signed content.
  • The report collapses two signatures into one DKIM status.
  • DKIM pass is incorrectly reported as DMARC alignment.
  • Private key permissions or provider delegation are not controlled.

Production acceptance checklist

  • Inventory every signing stream, domain, selector, algorithm and key size.
  • Remove rsa-sha1 signing and verification assumptions.
  • Use RSA-SHA256 with at least 2048-bit keys for the compatibility baseline.
  • Confirm the selected signer explicitly supports RFC 8463 before enabling Ed25519.
  • Publish separate, unique RSA and Ed25519 selectors.
  • Verify public-key bytes and DNS TXT concatenation.
  • Dual-sign final messages during compatibility measurement.
  • Capture received raw messages and per-signature receiver results.
  • Measure DMARC alignment separately for each passing signature.
  • Rotate through new selectors with DNS overlap.
  • Retain old public keys for delayed verification.
  • Protect private keys and document delegated signer authority.

Current standards interpretation

RFC 8301 and RFC 8463 update the DKIM algorithm framework defined by RFC 6376. RSA-SHA256 remains mandatory as specified by RFC 8301. Ed25519-SHA256 is an additional standards-defined method with compact DNS keys. Implementation support and receiver reporting can still vary, so sender migration should be based on received evidence rather than algorithm availability in a crypto library.

This guide was reviewed on October 28, 2026. Check current signer documentation, receiver behavior and the IANA DKIM parameter registries before changing production algorithms.

Primary standards and registries

Related technical notes

Technical review

Need this checked against your own sending system?

Share the domain, headers, bounces, provider warning, logs, or infrastructure symptom and NitWings will identify the practical next step.

Schedule a Technical Review
Advertisement