dnsbase
Copyright(c) Viktor Dukhovni 2026
LicenseBSD-3-Clause
Maintainerietf-dane@dukhovni.org
Stabilityunstable
Safe HaskellNone
LanguageGHC2024

Net.DNSBase.RData.NSEC

Description

DNSSEC denial-of-existence machinery. T_nsec (RFC 4034) names the next existing owner in canonical order alongside a bitmap of present RR types at the proving name. T_nsec3 (RFC 5155) is the hashed variant, where the next-name pointer is the hashed owner. T_nsec3param (RFC 5155) carries the zone-wide NSEC3 hashing parameters at the zone apex. T_nxt (RFC 2535) is the obsolete predecessor of NSEC, defined here for compatibility with archival zone data.

Synopsis

NSEC, NSEC3, and NSEC Type Bitmap structures

data T_nsec Source #

The NSEC resource record (RFC 4034 section 4) — the building block of authenticated denial of existence: a Domain naming the next existing owner in the zone's canonical order, plus an NsecTypes bitmap of RR types present at the proving name.

The next-owner-name field is not subject to wire-form name compression (RFC 3597 section 4) and is not lower-cased when computing canonical wire form (RFC 6840 section 5.1).

See T_nsec3 for the hashed-name variant.

Constructors

T_NSEC 

Instances

Instances details
Presentable T_nsec Source # 
Instance details

Defined in Net.DNSBase.RData.NSEC

KnownRData T_nsec Source # 
Instance details

Defined in Net.DNSBase.RData.NSEC

Associated Types

type RDataExtensionVal T_nsec 
Instance details

Defined in Net.DNSBase.RData.NSEC

Show T_nsec Source # 
Instance details

Defined in Net.DNSBase.RData.NSEC

Eq T_nsec Source # 
Instance details

Defined in Net.DNSBase.RData.NSEC

Methods

(==) :: T_nsec -> T_nsec -> Bool #

(/=) :: T_nsec -> T_nsec -> Bool #

Ord T_nsec Source # 
Instance details

Defined in Net.DNSBase.RData.NSEC

type RDataExtensionVal T_nsec Source # 
Instance details

Defined in Net.DNSBase.RData.NSEC

data T_nsec3 Source #

The NSEC3 resource record (RFC 5155 section 3.2) — the hashed denial-of-existence variant. The next-owner-name field carries the hashed equivalent rather than the plain name, and the record itself includes the hashing parameters (algorithm, flags, iteration count, salt) needed to reproduce the hash. The trailing NsecTypes bitmap names the RR types present at the proving (un-hashed) name.

                     1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3
 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|   Hash Alg.   |     Flags     |          Iterations           |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|  Salt Length  |                     Salt                      /
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|  Hash Length  |             Next Hashed Owner Name            /
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
/                         Type Bit Maps                         /
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

The Ord instance compares the fields in wire-encoding order, using dnsTextCmp on the length-prefixed salt and hashed-name bytes, so it agrees with the canonical RR-content ordering of RFC 4034 section 6.2.

See T_nsec for the un-hashed variant and T_nsec3param for the zone-apex parameter record.

Instances

Instances details
Presentable T_nsec3 Source # 
Instance details

Defined in Net.DNSBase.RData.NSEC

KnownRData T_nsec3 Source # 
Instance details

Defined in Net.DNSBase.RData.NSEC

Associated Types

type RDataExtensionVal T_nsec3 
Instance details

Defined in Net.DNSBase.RData.NSEC

Show T_nsec3 Source # 
Instance details

Defined in Net.DNSBase.RData.NSEC

Eq T_nsec3 Source # 
Instance details

Defined in Net.DNSBase.RData.NSEC

Methods

(==) :: T_nsec3 -> T_nsec3 -> Bool #

(/=) :: T_nsec3 -> T_nsec3 -> Bool #

Ord T_nsec3 Source # 
Instance details

Defined in Net.DNSBase.RData.NSEC

type RDataExtensionVal T_nsec3 Source # 
Instance details

Defined in Net.DNSBase.RData.NSEC

data T_nsec3param Source #

The NSEC3PARAM resource record (RFC 5155 section 4.2) — a zone-apex record describing the NSEC3 hashing parameters (algorithm, iteration count, salt) in use across the zone's NSEC3 chain. Validating resolvers do not consult this record (each T_nsec3 carries its own parameters in the RDATA); it exists for authoritative-server tooling.

                     1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3
 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|   Hash Alg.   |     Flags     |          Iterations           |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|  Salt Length  |                     Salt                      /
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

(Editorial: the salt and iteration count were largely a bad idea in retrospect; best practice for zone signers is to set the salt empty and the iteration count to zero.)

See T_nsec3 for the records produced under these parameters.

Instances

Instances details
Presentable T_nsec3param Source # 
Instance details

Defined in Net.DNSBase.RData.NSEC

KnownRData T_nsec3param Source # 
Instance details

Defined in Net.DNSBase.RData.NSEC

Associated Types

type RDataExtensionVal T_nsec3param 
Instance details

Defined in Net.DNSBase.RData.NSEC

Show T_nsec3param Source # 
Instance details

Defined in Net.DNSBase.RData.NSEC

Eq T_nsec3param Source # 
Instance details

Defined in Net.DNSBase.RData.NSEC

Ord T_nsec3param Source # 
Instance details

Defined in Net.DNSBase.RData.NSEC

type RDataExtensionVal T_nsec3param Source # 
Instance details

Defined in Net.DNSBase.RData.NSEC

data NsecTypes Source #

Abstract representation of a set of RRTYPE codepoints, stored as the window-based wire-format bitmap from RFC 4034 section 4.1.2. Used by T_nsec, T_nsec3, and T_csync to carry the set of types present at the owner name.

An NsecTypes may legitimately be empty -- this is the expected encoding for an NSEC3 empty-non-terminal. With NSEC, the type bitmap is expected to include at least the NSEC type itself; that invariant is not enforced by the type.

Construction and enumeration go through IsList:

  • fromList tys :: NsecTypes builds the bitmap from a list of RRTYPE values; duplicates are merged and the wire-form ordering is canonical regardless of input order. Under OverloadedLists the same input shape is just [A, AAAA, MX].
  • toList bm :: [RRTYPE] enumerates the contained types in ascending wire-form order.
  • (<>) unions two bitmaps; mempty is the empty bitmap.

For membership without enumerating the whole set, use hasRRtype, which goes directly to the relevant window, block and bit offset.

Instances

Instances details
Presentable NsecTypes Source #

Presentation form: contained types in canonical wire-form order, space-separated, with no leading separator. The empty bitmap renders as the empty string. When the bitmap follows another field in an RR's presentation form, compose with presentSp or presentLn to prefix the appropriate separator.

Instance details

Defined in Net.DNSBase.NsecTypes

Semigroup NsecTypes Source #

The (<>) operator unions the two bitmaps; duplicate types are merged.

Instance details

Defined in Net.DNSBase.NsecTypes

IsList NsecTypes Source #

Construction is via fromList (from any list of RRTYPEs, order and duplicates immaterial), and enumeration is via toList (yielding types in canonical wire-form order).

Instance details

Defined in Net.DNSBase.NsecTypes

Associated Types

type Item NsecTypes 
Instance details

Defined in Net.DNSBase.NsecTypes

Show NsecTypes Source # 
Instance details

Defined in Net.DNSBase.NsecTypes

Eq NsecTypes Source # 
Instance details

Defined in Net.DNSBase.NsecTypes

Ord NsecTypes Source #

The Ord instance matches wire-form canonical order.

Instance details

Defined in Net.DNSBase.NsecTypes

type Item NsecTypes Source # 
Instance details

Defined in Net.DNSBase.NsecTypes

nsecTypesFromList :: [RRTYPE] -> NsecTypes Source #

Construct the per-window bitmaps from a list of types.

nsecTypesToList :: NsecTypes -> [RRTYPE] Source #

Convert NsecTypes bitmap to an RRTYPE list

hasRRtype :: RRTYPE -> NsecTypes -> Bool Source #

Efficient NSEC/NSEC3 type bitmap membership predicate.

Obsolete NXT structure

data T_nxt Source #

The NXT resource record (RFC 2535 section 5.2) — the obsolete predecessor of T_nsec, defined here for compatibility with archival DNSSEC zone data. Same conceptual shape as NSEC (next owner name + type bitmap) but with a different type-bitmap encoding.

                     1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3
 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                  next domain name                             /
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                    type bit map                               /
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

The domain name is wire-form name-compressed on decode only (RFC 3597 section 4) and canonicalises to lower case (RFC 4034 section 6.2). The Eq and Ord instances compare the domain field in canonical wire form (via equalWireHost / compareWireHost) and the type bitmap byte-wise.

See T_nsec for the modern replacement.

Constructors

T_NXT 

Instances

Instances details
Presentable T_nxt Source # 
Instance details

Defined in Net.DNSBase.RData.NSEC

KnownRData T_nxt Source # 
Instance details

Defined in Net.DNSBase.RData.NSEC

Associated Types

type RDataExtensionVal T_nxt 
Instance details

Defined in Net.DNSBase.RData.NSEC

Methods

rdataExtensionVal :: forall b -> b ~ T_nxt => RDataExtensionVal T_nxt Source #

rdType :: forall b -> b ~ T_nxt => RRTYPE Source #

rdTypePres :: forall b -> b ~ T_nxt => Builder -> Builder Source #

rdDecode :: forall b -> b ~ T_nxt => RDataExtensionVal T_nxt -> Int -> SGet RData Source #

rdEncode :: T_nxt -> SPut s RData Source #

cnEncode :: T_nxt -> SPut s RData Source #

Show T_nxt Source # 
Instance details

Defined in Net.DNSBase.RData.NSEC

Methods

showsPrec :: Int -> T_nxt -> ShowS #

show :: T_nxt -> String #

showList :: [T_nxt] -> ShowS #

Eq T_nxt Source # 
Instance details

Defined in Net.DNSBase.RData.NSEC

Methods

(==) :: T_nxt -> T_nxt -> Bool #

(/=) :: T_nxt -> T_nxt -> Bool #

Ord T_nxt Source # 
Instance details

Defined in Net.DNSBase.RData.NSEC

Methods

compare :: T_nxt -> T_nxt -> Ordering #

(<) :: T_nxt -> T_nxt -> Bool #

(<=) :: T_nxt -> T_nxt -> Bool #

(>) :: T_nxt -> T_nxt -> Bool #

(>=) :: T_nxt -> T_nxt -> Bool #

max :: T_nxt -> T_nxt -> T_nxt #

min :: T_nxt -> T_nxt -> T_nxt #

type RDataExtensionVal T_nxt Source # 
Instance details

Defined in Net.DNSBase.RData.NSEC

data NxtTypes Source #

Instances

Instances details
Presentable NxtTypes Source # 
Instance details

Defined in Net.DNSBase.NsecTypes

IsNonEmptyList NxtTypes Source # 
Instance details

Defined in Net.DNSBase.NsecTypes

Associated Types

type Item1 NxtTypes 
Instance details

Defined in Net.DNSBase.NsecTypes

Semigroup NxtTypes Source #

Concatentation va (<>) operator merges the two bitmaps.

Instance details

Defined in Net.DNSBase.NsecTypes

Show NxtTypes Source # 
Instance details

Defined in Net.DNSBase.NsecTypes

Eq NxtTypes Source # 
Instance details

Defined in Net.DNSBase.NsecTypes

Ord NxtTypes Source #

The Ord instance matches wire-form canonical order.

Instance details

Defined in Net.DNSBase.NsecTypes

type Item1 NxtTypes Source # 
Instance details

Defined in Net.DNSBase.NsecTypes

data NxtRRtype Source #

An RRtype representable in an NXT RR bitmap.

toNxtTypes :: NonEmpty RRTYPE -> NxtTypes Source #

An error if any of input RRtypes are above 127.

nxtTypesFromNE :: NonEmpty NxtRRtype -> NxtTypes Source #

Construct the bitmap from a non-empty list of types.

nxtTypesToNE :: NxtTypes -> NonEmpty NxtRRtype Source #

Reconstruct RRTYPE list from bitmap.

hasNxtRRtype :: RRTYPE -> NxtTypes -> Bool Source #

Efficient NXT type bitmap membership predicate.