DNSKEY Record: What DNSSEC Public Key Records Are, Flags 256 vs 257, and Syntax

A DNSKEY record is a DNSSEC resource record published in your authoritative zone that stores the public cryptographic keys resolvers use to verify digital RRSIG signatures. Every signed domain publishes a Zone Signing Key (ZSK) and Key Signing Key (KSK). The flags field identifies each key's operational role.

Root Zone trust anchor .com Registry TLD Your Domain example.com DS DS Validating Resolver checks every link DNSKEY KSK + ZSK signs Your Records (signed with ZSK) every link must verify: one break = SERVFAIL for the entire domain
DNSSEC Chain of Trust: validating recursive resolvers verify child DNSKEY records against parent DS records to validate cryptographic RRSIG signatures

What Is a DNSKEY Record and What Do Its 4 Fields Mean? (Syntax and Anatomy)

A DNSKEY resource record (IANA Type 48, standardized in RFC 4034 to replace the obsolete Type 25 KEY record) publishes the public half of a domain's asymmetric DNSSEC key pairs directly inside the authoritative zone file. Your private signing keys stay hidden on your DNS provider's hardware security modules, whereas recursive resolvers fetch your public DNSKEY records to verify cryptographic RRSIG signatures across 4 data fields: Flags (256 or 257), Protocol (always 3), Algorithm, and Public Key (Base64). The table below defines all 4 fields of a standard DNSKEY record.

The following zone excerpt demonstrates how production DNSKEY records appear inside an authoritative zone file:

; Zone Name   TTL   Class  Type    Flags  Protocol  Algorithm  Base64 Public Key Data
example.com.  3600  IN     DNSKEY  256    3         13         mdsswUyr3DPW132mOi8V9xESWE8jTo0dxCjjnopKl+GqJxpVXckHAeF+KkxLbxILfDLUT0rAK9iUzy1L53eKGQ== ; ZSK
example.com.  3600  IN     DNSKEY  257    3         13         AwEAAaz/tAm8yTn4Mfeh5eyI96WSVexTBAvkMgJzkKTOiW1vkIbzxeF3+/4RgWOq7HrxRixHlFlExOLAJr5emLvN7SWXgnLh4+B5xQlNVz8= ; KSK

The table below details the 4 data fields comprising every standard DNS DNSKEY record, their formats, and their specific verification roles:

DNSKEY Field Example Value Bit Size / Format Function in DNSSEC Verification
1. Flags 256 or 257 16-bit integer bitmask Identifies key role: Bit 7 (256) marks a Zone Key (ZSK); Bit 15 (+1 = 257) sets the Secure Entry Point (SEP) flag for a Key Signing Key (KSK).
2. Protocol 3 8-bit integer (Fixed at 3) Fixed at 3 for DNSSEC protocol compatibility (RFC 2535/4034); other values are invalid.
3. Algorithm 13 8-bit integer (8, 13, 15) Public-key algorithm identifier (13 = ECDSAP256SHA256, 15 = Ed25519, 8 = RSASHA256).
4. Public Key mdsswUyr3D... Base64-encoded binary string Raw public key material used to verify RRSIG digital signatures.

The 16-bit Flags field supports additional operational states: setting Bit 8 (+128 = Flag 385 on a KSK) activates the REVOKE bit (RFC 5011), prompting validating resolvers to purge the retired KSK during automated rollovers. A Flags value of 0 denotes a disabled key with zero cryptographic authority. Administrators inspect active public keys and Key Tags in seconds using the DNSKEY Record Lookup.

DNSKEY Flag 256 (ZSK) vs Flag 257 (KSK): Why Does DNSSEC Use Two Keys?

DNSSEC separates public keys into a Zone Signing Key (ZSK, Flag 256) and a Key Signing Key (KSK, Flag 257) so DNS providers rotate daily operational signing keys frequently without forcing domain owners to update the parent TLD registry every month. The table below compares ZSK (256), KSK (257), and Combined Signing Keys (CSK) across 6 operational dimensions:

Feature / Dimension Zone Signing Key (ZSK - Flag 256) Key Signing Key (KSK - Flag 257) Combined Signing Key (CSK - Flag 257)
16-Bit Flags Value 256 (Bit 7 = 1, Bit 15 SEP = 0) 257 (Bit 7 = 1, Bit 15 SEP = 1) 257 (Single key performing both roles)
What Records It Signs Signs all zone RRsets (A, AAAA, MX, TXT, NS, SOA) Signs only the zone DNSKEY RRset (authorizing both keys) Signs both the DNSKEY RRset and all zone data RRsets
Linked to Parent DS Record? No (Unknown to the parent TLD registry) Yes (Its SHA-256 hash is published as the parent DS Record) Yes (Its SHA-256 hash is published as the parent DS record)
Typical Rotation Cadence Every 30 to 90 days (Automated internally) Every 12 to 24 months (Requires registrar DS update) Every 12 months (Requires registrar DS update)
Typical Key Size (RSA vs ECDSA) 1024-bit RSA or 256-bit ECDSA (Alg 13) 2048-bit RSA or 256-bit ECDSA (Alg 13) 256-bit ECDSA (Alg 13) or Ed25519 (Alg 15)
Operational Advantage Rotates with zero registrar involvement Anchors parent-to-child delegation long-term Minimizes DNSKEY packet size by publishing a single key

Adopting Algorithm 13 (ECDSAP256SHA256) optimizes DNSSEC efficiency across split-key and Combined Signing Key deployments. Legacy Algorithm 8 (RSASHA256) configurations produced oversized 2048-bit KSK records exceeding 1,200 bytes, causing IP fragmentation and elevating exposure to DNS Amplification Attacks. Algorithm 13 public keys require only 64 bytes (88 Base64 characters), preserving compact response sizes within standard UDP boundaries.

How Do Resolvers Use DNSKEY Records to Validate DNS Responses? (5 Steps)

Recursive resolvers validating a signed domain utilize the child zone's DNSKEY records as the cryptographic bridge between the parent DS hash and the target record's RRSIG signature across 5 verification steps:

  1. Request the target record (example.com A) with the EDNS0 DO=1 (DNSSEC OK) bit, receiving the record set alongside its private-ZSK RRSIG signature.
  2. Query example.com for its complete DNSKEY RRset, receiving the public ZSK 256, public KSK 257, and covering RRSIG signature.
  3. Hash the public KSK (DNSKEY 257) with SHA-256 and confirm that the digest matches the parent DS record published in the TLD zone, verifiable via the DS Record Lookup (DNSSEC).
  4. Validate the DNSKEY RRset RRSIG signature using the authenticated public KSK (257), confirming the sibling ZSK (256) remains authentic.
  5. Verify the A record RRSIG signature using the authenticated public ZSK (256) and return the IP address with the Authenticated Data (AD=1) flag set, preventing DNS Cache Poisoning.

Recursive resolvers cache verified DNSKEY RRsets in memory for the duration of the zone's DNS TTL Explained (typically 3,600 to 86,400 seconds), eliminating redundant parent hashing on subsequent user lookups. Administrators inspect the full cryptographic trust pathway across any domain using What Is DNSSEC and the automated DNSSEC Checker.

How Does a DNSKEY Record Relate to RRSIG, DS, and CDNSKEY Records?

A DNSKEY record never works in isolation; it interacts directly with 3 companion DNSSEC record types (RRSIG, DS, and CDNSKEY) to complete zone signing and automated key rollovers:

  1. DNSKEY vs. RRSIG (Type 46 - The Public Key vs. The Signature): The RRSIG record holds the cryptographic signature calculated over a resource record set (A, AAAA, MX, TXT), whereas the DNSKEY record provides the public key needed for mathematical verification. Every RRSIG record embeds a 16-bit Key Tag (such as 2371 or 34505) matching the identifier of the corresponding DNSKEY, instructing resolvers exactly which public key created the signature.
  2. DNSKEY vs. DS (Type 43 - The Child Public Key vs. The Parent Fingerprint): Your public KSK (DNSKEY Flag 257) resides inside the child zone (example.com), whereas the corresponding Delegation Signer (DS) record resides in the parent TLD registry (.com). The parent DS record contains a 64-character SHA-256 hash digest of the child KSK rather than raw public key data, establishing a secure delegation link without bloating parent zone files.
  3. DNSKEY vs. CDNSKEY (Type 60 - Automated Registrar Key Rollover Signal): Defined under RFC 7344, a Child DNSKEY (CDNSKEY) record shares the exact 4-field structure of a standard DNSKEY (Flags 257, Protocol 3, Algorithm 13, and Base64 key data). Managed DNS hosts initiating scheduled KSK rotations publish the new key as a CDNSKEY record in the child zone, prompting supporting parent registries and registrars to ingest the new key and update the parent DS record automatically without manual intervention.

Managed cloud DNS providers generate key pairs, publish signatures, and manage rollovers automatically. Enabling DNSSEC on production domains requires toggling the feature inside your DNS management console (detailed in How to Enable DNSSEC in Cloudflare) and submitting the generated DS digest to your registrar.

How to Check Your DNSKEY Records and Find the Key Tag (dig +multiline)

Extracting the 16-bit Key Tag (key id) and inspecting active public keys requires terminal dig +multiline diagnostics or browser lookup tools across 3 verification steps:

  1. Run dig example.com DNSKEY +multiline in your Linux, macOS, or WSL terminal to decode flags and print computed key identifiers:
    $ dig example.com DNSKEY +multiline
    
    ;; ANSWER SECTION:
    example.com. 3600 IN DNSKEY 256 3 13 (
            mdsswUyr3DPW132mOi8V9xESWE8jTo0dxCjjnopKl+Gq
            JxpVXckHAeF+KkxLbxILfDLUT0rAK9iUzy1L53eKGQ==
            ) ; ZSK; alg = ECDSAP256SHA256 ; key id = 34505
    
    example.com. 3600 IN DNSKEY 257 3 13 (
            AwEAAaz/tAm8yTn4Mfeh5eyI96WSVexTBAvkMgJzkKTO
            iW1vkIbzxeF3+/4RgWOq7HrxRixHlFlExOLAJr5emLvN
            ) ; KSK; alg = ECDSAP256SHA256 ; key id = 2371
  2. Match the KSK (257) comment ; key id = 2371 against the Key Tag displayed in dig example.com DS +short or in the browser-based DNS Delegation Checker to confirm your child KSK and parent DS record remain in perfect agreement.
  3. Verify that recursive nameservers globally answer with identical DNSKEY records using the DNS Propagation Checker.

Auditing DNSKEY record synchronization ensures cryptographic integrity across all DNS Record Types. Every production DNSSEC public key record (Type 48) anchors domain authentication by publishing Zone Signing Keys (Flag 256) and Key Signing Keys (Flag 257), enforcing Protocol 3 standards alongside Algorithm 13 ECDSA cryptography, and enabling recursive resolvers to verify digital RRSIG signatures against parent DS trust anchors.

Frequently Asked Questions

What is the difference between DNSKEY Flag 256 and Flag 257? ▾

Flag 256 identifies a Zone Signing Key (ZSK), which signs your domain's everyday DNS records (A, AAAA, MX, TXT) and rotates every 30 to 90 days. Flag 257 adds the Secure Entry Point (SEP) bit to identify a Key Signing Key (KSK), which signs the DNSKEY record set itself and links to your parent registrar's DS record.

Why is the Protocol field in a DNSKEY record always set to 3? ▾

The Protocol field is hardcoded to 3 in every valid DNSKEY record for backward compatibility with the original 1999 DNSSEC specification (RFC 2535), where 3 was the assigned protocol number for DNSSEC. Under modern RFC 4034 rules, any DNSKEY record with a Protocol value other than 3 is rejected as invalid.

Do I need to manually create or paste a DNSKEY record in my DNS control panel? ▾

No, in practice you never create a DNSKEY record manually on managed DNS providers like Cloudflare, AWS Route 53, or Google Cloud DNS. The moment you toggle DNSSEC ON in your DNS host's settings, the provider automatically generates the private keys in hardware and publishes the public 256 and 257 DNSKEY records in your zone.

Why do I see two Flag 256 (ZSK) DNSKEY records on my domain at the same time? ▾

In real-world operations, seeing two ZSK (Flag 256) records simultaneously is completely normal and means your DNS provider is in the middle of an automated pre-publish ZSK key rollover. The provider publishes the new ZSK alongside the current ZSK for one TTL cycle so global resolvers cache both keys before switching signatures over.

Last verified: 2026-11-02