EMAIL & DNS
DKIM generator
Generate a DKIM key pair (RSA or Ed25519) directly in your browser, together with the DNS record, a zone file entry and configuration for OpenDKIM and Rspamd. Check a selector to see the key that is currently published.
Keys are generated locally with the Web Crypto API; the private key never leaves your browser.
DNS record
Name: 202612._domainkey.example.com. TXT
Zone file entry
Private key
Store the private key only on the mail server and keep it secret. It is not saved anywhere – download it before leaving the page.
Configuration for OpenDKIM and Rspamd
OpenDKIM
# /etc/opendkim/keys/example.com/202612.private (private key, chown opendkim:opendkim, chmod 600) # /etc/opendkim/KeyTable 202612._domainkey.example.com example.com:202612:/etc/opendkim/keys/example.com/202612.private # /etc/opendkim/SigningTable (with SigningTable refile:/etc/opendkim/SigningTable) *@example.com 202612._domainkey.example.com
Rspamd
# /var/lib/rspamd/dkim/example.com.202612.key (private key, chown _rspamd:_rspamd, chmod 600)
# /etc/rspamd/local.d/dkim_signing.conf
domain {
example.com {
selectors [
{
path: "/var/lib/rspamd/dkim/example.com.202612.key";
selector: "202612";
}
]
}
}
Frequently asked questions
How does DKIM work?
The sending server signs selected headers and the body of each message with a private key and adds a DKIM-Signature header with the domain (d=) and the selector (s=). Receivers fetch the public key from the TXT record at <selector>._domainkey.<domain> and verify the signature. A valid signature of the From domain also satisfies DMARC.
RSA or Ed25519?
RSA 2048 is supported by every receiver and the safe default. Ed25519 keys are much shorter and faster, but not every receiver verifies them yet. If you want Ed25519, sign with both: an RSA key and an Ed25519 key under two selectors.
Why is the record split into several strings?
A single string in a TXT record may contain at most 255 bytes, and a 2048-bit RSA key is longer. The record is therefore stored as several quoted strings that receivers join without spaces. Most DNS web interfaces split automatically; in zone files, use the entry shown here.
How do I rotate a DKIM key?
Generate a key with a new selector and publish its record. Once it resolves, switch the mail server to the new key. Keep the old record for a few days so mail in transit can still be verified, then revoke it with an empty p= or delete it.
Where do I find the selector of an existing setup?
In the DKIM-Signature header of a sent message: s= is the selector and d= the domain. Mail providers usually document their selectors, e.g. google for Google Workspace or selector1 and selector2 for Microsoft 365.