DNSKEY flags and algorithms — telling KSK from ZSK and choosing one
In one line: What flags 256 and 257 mean together with the SEP and REVOKE bits, why protocol must be 3, and how to choose between algorithms 8, 13, 14, 15 and 16.
The flags field of a DNSKEY says what the key does. Most operators memorise 256 and 257 and move on, but a single bit changes both rollover procedure and validation behaviour.
1. Reading the flag bits
| Bit | Value | Meaning |
|---|---|---|
| 0x0100 | 256 | Zone Key: this key signs zone data. Required for any DNSKEY. |
| 0x0001 | 1 | SEP (Secure Entry Point): the key a parent DS points at. Set on a KSK. |
| 0x0080 | 128 | REVOKE: the key is revoked and must not be trusted. |
- 256 — zone key only: a ZSK, signing ordinary zone data.
- 257 — zone key plus SEP: a KSK, signing the DNSKEY RRset and linked to the parent by DS.
- A single 257 key (a CSK, combined signing key) is common on small zones and simpler to operate.
Protocol must always be 3. Any other value makes resolvers ignore the key; the DNSSECLab linter reports it as an error.
2. Algorithm numbers
| No. | Name | Status | Public key |
|---|---|---|---|
| 8 | RSASHA256 | usable | 1280–4096 bits |
| 10 | RSASHA512 | usable | 1280–4096 bits |
| 13 | ECDSAP256SHA256 | recommended | 64 bytes |
| 14 | ECDSAP384SHA384 | recommended | 96 bytes |
| 15 | ED25519 | recommended | 32 bytes |
| 16 | ED448 | usable | 57 bytes |
| 5, 7 | RSASHA1 family | deprecated | — |
| 1, 3, 6 | RSAMD5, DSA family | obsolete | — |
RFC 8624 recommends ECDSA P-256/P-384 and Ed25519 for new deployments, and SHA-256 or better when using RSA. SHA-1 algorithms remain only for validator compatibility.
3. Choosing
- Maximum compatibility: algorithm 8 (RSA/SHA-256), 2048 bits or more.
- General purpose: algorithm 13 (ECDSA P-256); short signatures, fast validation.
- Smallest responses: algorithm 15 (Ed25519); 32-byte keys and 64-byte signatures. Check that your tooling supports it.
- Policy driven: P-384 (14) or Ed448 (16) where stronger parameters are required.
Changing algorithm is not the same as changing keys: publish the new DNSKEY first, add the new DS at the parent, then remove the old key. Skipping a step breaks validation.
4. Key lengths and TTLs
Public key lengths are fixed per algorithm: 64 bytes for 13, 96 for 14, 32 for 15. The linter reports a mismatch as L_DNSKEY_LEN. DNSKEY and DS TTLs bound how long an old key can still be cached, so lower them before a rollover.
Computing a single DS record makes the relationship between the key tag and the digest concrete.
Open DNSSECLabFrequently asked questions
Do I have to separate KSK and ZSK?
No. A small zone can run a single 257 key (CSK). Separating them makes key rollover cheaper because the DNSKEY RRset signing and zone data signing are managed independently.
What happens if REVOKE is set on a 257 key?
Resolvers treat the key as revoked and stop trusting it. It is used for emergency revocation after a key compromise, and setting it by accident causes immediate validation failure.
Why choose Ed25519 (15)?
Keys are 32 bytes and signatures 64, so DNS responses are smaller and validation faster than RSA. Older appliances and some management tools may not support it, so test first.
References
- RFC 4034 — Resource Records for the DNS Security Extensions
- RFC 8624 — Algorithm Implementation Requirements and Usage Guidance for DNSSEC
- IANA — DNSSEC Algorithm Numbers
Read next
- Turning a DNSKEY into a DS record — key tag and digest, step by stepHow to derive the key tag from a DNSKEY and build a SHA-256 DS record, with a worked example and the order in which parent and child zones are updated.
- BIND zone syntax — $ORIGIN, $TTL, @ and a correct SOAZone file structure and omission rules, what each SOA timer means, and the CNAME, MX and TXT details that are most often wrong.
- CAA, SPF and TXT lint — the mistakes that block certificates and emailCAA flags, tags and values, the SPF ten-lookup limit, the single-SPF rule, and splitting TXT strings at 255 bytes.