Skip to content

EDnsAlgorithms

Jay edited this page Oct 3, 2026 · 2 revisions

EDnsAlgorithms

#include <certpp/dnssec/records.hpp> --- certpp::dnssec

DNSSEC algorithm numbers, as IANA assigns them. The numeric values are part of the wire format, so they are pinned explicitly rather than left to run in declaration order.

Enumerators

Enumerator Value Meaning
EDNSALG_UNKNOWN 0 Not a recognised algorithm number
EDNSALG_RSAMD5 1 RSA/MD5 (RFC 3110); must not be used (RFC 8624)
EDNSALG_DSA 3 DSA/SHA-1 (RFC 2536)
EDNSALG_RSASHA1 5 RSA/SHA-1 (RFC 3110)
EDNSALG_DSA_NSEC3_SHA1 6 DSA-NSEC3-SHA1 (RFC 5155)
EDNSALG_RSASHA1_NSEC3_SHA1 7 RSASHA1-NSEC3-SHA1 (RFC 5155)
EDNSALG_RSASHA256 8 RSA/SHA-256 (RFC 5702)
EDNSALG_RSASHA512 10 RSA/SHA-512 (RFC 5702)
EDNSALG_ECC_GOST 12 GOST R 34.10-2001 (RFC 5933); must not be used
EDNSALG_ECDSAP256SHA256 13 ECDSA P-256 with SHA-256 (RFC 6605)
EDNSALG_ECDSAP384SHA384 14 ECDSA P-384 with SHA-384 (RFC 6605)
EDNSALG_ED25519 15 Ed25519 (RFC 8080)
EDNSALG_ED448 16 Ed448 (RFC 8080)

Example

The algorithm number selects the hash too -- RFC 5702, 6605 and 8080 bind one to the other instead of leaving it to the signer -- so hasherOf() is how a verifier decides what to hash with. It reports EHASH_UNKNOWN with a true return for Ed25519 and Ed448, which hash internally and take the signed data whole; treating that as a failure would reject two supported algorithms.

// given: EDnsAlgorithms algorithm, const SReadOnlyByteSpan& signedData
crypto::EHashers which = crypto::EHASH_UNKNOWN;
if (!CDnssecKeys::hasherOf(algorithm, which)) {
    return;                     // e.g. EDNSALG_ECC_GOST, named so it can be rejected
}

if (which == crypto::EHASH_UNKNOWN) {
    return;                     // Ed25519/Ed448: pass signedData to verify() unhashed
}

crypto::IHasherPtr hasher;
if (crypto::IHasher::create(which, hasher) != ERET_OK) {
    return;
}

if (hasher->push(signedData) != signedData.size) {
    return;
}

// byteWidth() is the digest length this algorithm number implies: 32 for
// EDNSALG_ECDSAP256SHA256, 48 for EDNSALG_ECDSAP384SHA384, 64 for EDNSALG_RSASHA512.
uint8_t buffer[64];
const SByteSpan digest(buffer, hasher->byteWidth());
if (!hasher->finish(digest)) {
    return;
}

Reference generated from certpp/dnssec/records.hpp at commit 0834b29 (v1.0.1). The header is authoritative --- if this page disagrees with it, the header is right and this page needs regenerating.

Clone this wiki locally