A new DKIM selector is published in cPanel’s Zone Editor. The web UI accepts the record. The Zone Editor saves it. dig +short TXT default._domainkey.example.com returns the record. But every receiving server reports DKIM as permerror — no key for signature, and the record looks fine to the human eye. The reason is character-string segmentation, and almost nothing about the cPanel UI flags it.
What’s happening
A DNS TXT record is made of one or more “character strings”, each capped at 255 bytes by RFC 1035. Multiple strings in a single record are concatenated by the resolver. A 2048-bit RSA public key encoded in base64 is around 400 bytes — too long for one string. The zone file syntax represents this as multiple quoted strings on the same line:
default._domainkey IN TXT "v=DKIM1; k=rsa; p=MIGfMA0G..." "...long-base64-continued..."
If a tool publishes the key as a single 400-byte string, BIND named may either:
- Truncate at 255 bytes (older BIND) — DKIM validators see a partial key, decode fails.
- Reject the zone (newer BIND) —
named-checkzoneerrors with “TXT string too long”.
cPanel’s Zone Editor handles this correctly when you use the dedicated DKIM tool — it splits the key automatically. The break happens when an admin pastes a key into the raw TXT field, or when a script publishes via whmapi1 addzonerecord with the key as one argument.
How to verify
Look at the on-disk zone file (not the UI representation):
grep -A2 '_domainkey' /var/named/example.com.db
You should see multiple quoted strings on the value line, separated by spaces. If you see one long string with no internal quotes, segmentation is wrong.
Confirm what resolvers actually receive:
dig +short TXT default._domainkey.example.com
dig +noall +answer TXT default._domainkey.example.com
+short shows the concatenated value as one string with quote marks around each segment. +noall +answer shows the raw record line as named returns it.
Validate the DKIM:
dig +short TXT default._domainkey.example.com | tr -d '" ' | head
opendkim-testkey -d example.com -s default -vvv
opendkim-testkey decodes the key. A “key OK” message means the segmentation is fine; “key parse failed” or similar means the key is corrupt — usually because of mis-segmentation.
What to do
- Use cPanel’s DKIM tool, not the manual TXT editor. WHM > Email Deliverability > DKIM has Generate and Install actions. The tool handles segmentation correctly.
- If you must publish via API or a third-party DNS, split the key into 255-byte segments yourself. The format is:
"v=DKIM1; k=rsa; p=MIGfMA0GCSqGSIb3DQEB..." "...rest-of-key..."
Each segment is quoted; the resolver concatenates. Many DNS providers’ UIs accept this format directly; others have a “long TXT” mode that does the split for you.
- For DNS provided by Cloudflare, Route 53, or similar, those providers handle segmentation internally — you paste the key as one line, they split it on publication. If you’re using cPanel as the authoritative DNS, you must split it explicitly.
- Confirm the published key parses with
opendkim-testkeybefore pointing a real mail flow at it. A broken DKIM is silent until the first message goes out — every signed message fails verification, and you find out from bounce reports. - For 4096-bit keys, the segmentation is more aggressive — you may need three or four segments. Some DNS providers cap TXT records at a smaller size than the spec allows; check the provider’s limit before generating a 4096-bit key.
A common related issue: an old DKIM key is left in the zone after rotation. The selector matches an inactive private key on the server. Receivers see two valid-looking selectors but only one signs current mail. Delete obsolete selectors after the rotation completes.
Stack Harbor manages DKIM key lifecycle including segmentation across multi-domain fleets as part of cPanel server management.