DNSSEC-KEYGEN(1)
π dnssec-keygen β the DNSSEC key generation tool (BIND 9) π
okay so this is the manual page for dnssec-keygen, straight out of the BIND 9 docs, and it's a big one bestie β we're doing it in two parts because there's genuinely that much lore. part 1 is right here. grab a snack π
β¨ NAME β¨
dnssec-keygen β the DNSSEC key generation tool, aka the little guy that makes your cryptographic keys π
β¨ SYNOPSIS β¨
dnssec-keygen [-3] [-A date/offset] [-a algorithm] [-b keysize] [-C] [-c
class] [-D date/offset] [-d bits] [-D sync date/offset] [-E engine] [-f
flag] [-F] [-G] [-h] [-I date/offset] [-i interval] [-K directory] [-k
policy] [-L ttl] [-l file] [-n nametype] [-M tag_min:tag_max] [-P
date/offset] [-P sync date/offset] [-p protocol] [-q] [-R date/offset]
[-S key] [-s strength] [-T rrtype] [-t type] [-V] [-v level] {name}
yes, -D shows up twice and -P shows up twice up there β that's not a typo on my end, that's literally what the page says, so I'm keeping it exactly as-is π
β¨ DESCRIPTION β¨
dnssec-keygen generates keys for DNSSEC (Secure DNS), as defined in RFC 2535 (https://datatracker.ietf.org/doc/html/rfc2535.html) and RFC 4034 (https://datatracker.ietf.org/doc/html/rfc4034.html). that's the whole elevator pitch, no cap π
the name of the key is specified on the command line, bestie. and for DNSSEC keys specifically, that name must match the name of the zone you're generating the key for. no matchy-matchy, no key-y-key-y π
β¨ OPTIONS β¨
so many options. all of them. here we go πββοΈπ¨
-3β uses an NSEC3-capable algorithm to generate a DNSSEC key. if you use this with an algorithm that has both NSEC and NSEC3 versions, the NSEC3 version gets picked; for example,dnssec-keygen -3 -a RSASHA1specifies theNSEC3RSASHA1(deprecated) algorithm. it's giving "pick the shiny new one" β¨-aalgorithm β picks the cryptographic algorithm. for DNSSEC keys, algorithm must be one ofRSASHA1(deprecated),NSEC3RSASHA1(deprecated),RSASHA256,RSASHA512,ECDSAP256SHA256,ECDSAP384SHA384,ED25519, orED448. these values are case-insensitive. some abbreviations are supported too, likeECDSA256forECDSAP256SHA256andECDSA384forECDSAP384SHA384. ifRSASHA1(deprecated) is specified along with the-3option,NSEC3RSASHA1(deprecated) is used instead. this parameter must be specified β except when you're using the-Soption, which copies the algorithm from the predecessor key. π«Ά in prior releases, HMAC algorithms could be generated for use as TSIG keys, but that feature was removed in BIND 9.13.0. usetsig-keygento generate TSIG keys now. rip to a real one π-bkeysize β specifies the number of bits in the key. the choice of key size depends on the algorithm: RSA keys must be between 1024 and 4096 bits; Diffie-Hellman keys must be between 128 and 4096 bits. elliptic curve algorithms don't need this parameter at all, they're low maintenance like that π¦ if the key size isn't specified, some algorithms have pre-defined defaults. for example, RSA keys for use as DNSSEC zone-signing keys have a default size of 1024 bits; RSA keys for use as key-signing keys (KSKs, generated with-f KSK) default to 2048 bits.-Cβ enables compatibility mode, which generates an old-style key, without any timing metadata. by default,dnssec-keygenincludes the key's creation date in the metadata stored with the private key; other dates may be set there as well, including publication date, activation date, etc. keys that include this data may be incompatible with older versions of BIND, so the-Coption suppresses them. vintage mode, essentially ποΈ-cclass β says the DNS record containing the key should have the specified class. if you don't specify, classINis used. the default default-est default πΈ-dbits β specifies the key size in bits. for the algorithmsRSASHA1,NSEC3RSASA1,RSASHA256, andRSASHA512the key size must be between 1024 and 4096 bits; DH size is between 128 and 4096 bits. this option is ignored for algorithmsECDSAP256SHA256,ECDSAP384SHA384,ED25519, andED448. (and yes,NSEC3RSASA1is spelled exactly like that in the page β leaving it verbatim, don't come for me π)-Eengine β specifies the cryptographic hardware to use, when applicable. when BIND 9 is built with OpenSSL, this needs to be set to the OpenSSL engine identifier that drives the cryptographic accelerator or hardware service module (usuallypkcs11).-fflag β sets the specified flag in the flag field of the KEY/DNSKEY record. the only recognized flags areZSK(Zone-Signing Key),KSK(Key-Signing Key) andREVOKE. note thatZSKis not a physical flag in the DNSKEY record β it's merely used to explicitly tell the tool that you want to create a ZSK. setting-fin conjunction with-kwill result in generating keys that only match the given role set with this option. roleplay, but make it cryptography π-Fβ turns on FIPS (US Federal Information Processing Standards) mode if the underlying cryptographic library supports running in FIPS mode. government-issued vibes ποΈ-Gβ generates a key, but does not publish it or sign with it. this option is incompatible with-Pand-A. a key that simply exists and minds its own business π-hβ prints a short summary of the options and arguments todnssec-keygen. the "help me bestie" button π«Ά-Kdirectory β sets the directory in which the key files are to be written. where the babies live π-kpolicy β creates keys for a specificdnssec-policy. if a policy uses multiple keys,dnssec-keygengenerates multiple keys. this also creates a.statefile to keep track of the key state.
heads up: this option creates keys according to thednssec-policyconfiguration, hence it cannot be used at the same time as many of the other options thatdnssec-keygenprovides. it's a whole different mode, don't mix it π«
-Lttl β sets the default TTL to use for this key when it's converted into a DNSKEY RR. this is the TTL used when the key is imported into a zone, unless there was already a DNSKEY RRset in place, in which case the existing TTL takes precedence. if this value isn't set and there's no existing DNSKEY RRset, the TTL defaults to the SOA TTL. setting the default TTL to0ornoneis the same as leaving it unset. same energy, different spelling β¨-lfile β provides a configuration file that contains adnssec-policystatement (matching the policy set with-k). they're a matching set, like a charm bracelet π-Mtag_min:tag_max β sets the range of acceptable key tag values thatdnssec-keygenwill produce. if the key tag of the new key, or the key tag of the revoked version of the new key, is outside this range, the new key will be rejected and another new key will be generated. this is designed to be used when generating keys in a multi-signer scenario, where each operator is given a range of key tags to prevent collisions among different operators. the valid values for tag_min and tag_max are[0..65535]. the default allows all key tag values to be produced. this option is ignored when-kpolicy is specified. everybody gets their own lane, no crashing into each other ππ¨-nnametype β specifies the owner type of the key. the value of nametype must either beZONE(for a DNSSEC zone key (KEY/DNSKEY)),HOSTorENTITY(for a key associated with a host (KEY)),USER(for a key associated with a user (KEY)), orOTHER(DNSKEY). these values are case-insensitive. the default isZONEfor DNSKEY generation. pick your fighter π-pprotocol β sets the protocol value for the generated key, for use with-T KEY. the protocol is a number between 0 and 255. the default is3(DNSSEC). other possible values for this argument are listed in RFC 2535 (https://datatracker.ietf.org/doc/html/rfc2535.html) and its successors. go read, i'll wait π-qβ sets quiet mode, which suppresses unnecessary output, including progress indication. without this option, whendnssec-keygenis run interactively to generate an RSA or DSA key pair, it prints a string of symbols tostderrindicating the progress of the key generation. a.means that a random number has been found which passed an initial sieve test;+means a number has passed a single round of the Miller-Rabin primality test; and a space () means that the number has passed all the tests and is a satisfactory key. it's like a little loading bar but made of punctuation, obsessed π-Skey β creates a new key which is an explicit successor to an existing key. the name, algorithm, size, and type of the key are set to match the existing key. the activation date of the new key is set to the inactivation date of the existing one. the publication date is set to the activation date minus the prepublication interval, which defaults to30days. passing the torch, main character energy π₯-sstrength β specifies the strength value of the key. the strength is a number between0and15, and currently has no defined purpose in DNSSEC. it's decorative, your honor π-Trrtype β specifies the resource record type to use for the key. rrtype must be eitherDNSKEYorKEY. the default isDNSKEYwhen using a DNSSEC algorithm, but it can be overridden toKEYfor use with SIG(0).-ttype β indicates the type of the key for use with-T KEY. type must be one ofAUTHCONF,NOAUTHCONF,NOAUTH, orNOCONF. the default isAUTHCONF.AUTHrefers to the ability to authenticate data, andCONFto the ability to encrypt data. auth and conf, the original power couple π―ββοΈ-Vβ prints version information. "who are you" but polite πΈ-vlevel β sets the debugging level. turn it up if things get weird π
and that's the options section done, but we are not done done bestie β there's more page coming in part 2, so don't wander off π¦
β° TIMING OPTIONS β°
ok so before we get into the flags, bestie, we gotta talk about how you're allowed to write a date, because there are like five whole ways and you only need one π
YYYYMMDDβ short and sweetYYYYMMDDHHMMSSβ the longer one (this is literally the format used inside key files, iykyk)'Day Mon DD HH:MM:SS YYYY'β that's the onednssec-settime -pprints out at you- UNIX epoch time β the one
dnssec-settime -upspits out - the literal string
nowβ iconic, no notes β¨
and here's the fun part π you can stick a + or - and an offset right after your time argument, and it'll do the math for you. and if you're using now, you can just... leave now out entirely before the offset, slay.
the offset can then be followed by one of these suffixes so it knows what unit you mean:
yβ years (defined as 365 24-hour days, leap years fully ignored, no cap)moβ months (defined as 30 24-hour days)wβ weeksdβ dayshβ hoursmiβ minutes
no suffix at all? then your offset is computed in seconds. periodt.
and to unset a date, you use none, never, or unset. bye date π
-Pdate/offset β sets the date when the key gets published to the zone. after that date, the key is in the zone but it is not being used to sign it. if you don't set it, and you haven't used the-Goption, the default is the current date.syncdate/offset β sets the date when the CDS and CDNSKEY records that match this key get published to the zone. π«Ά
-Adate/offset β sets the date when the key gets activated. after that date, the key is in the zone and it is used to sign it. if you don't set it, and you haven't used-G, default is the current date. and here's the cute little domino effect: if you set this but you don't set-P, then the publication date gets set to the activation date minus the prepublication interval. math! π-Rdate/offset β sets the date when the key gets revoked. after that date the key is flagged as revoked. it's still in the zone and it's still used to sign it. just, y'know, marked π-Idate/offset β sets the date when the key gets retired. after that date, the key is still included in the zone, but it is not used to sign it anymore. semi-retired, we love a soft launch πΈ-Ddate/offset β sets the date when the key gets deleted. after that date, the key is no longer included in the zone at all. (but ngl it might still be chilling in the key repository, so don't @ me.)syncdate/offset β sets the date when the CDS and CDNSKEY records that match this key get deleted. π
-iinterval β sets the prepublication interval for a key. if it's set, then your publication and activation dates have to be separated by at least this much time. and if you specify the activation date but not the publication date, the publication date defaults to this much time before activation. conversely (yes, conversely, I said it π), if you specify the publication date but not the activation date, activation gets set to this much time after publication.
if the key is being created as an explicit successor to another key, the default prepublication interval is 30 days; otherwise it's zero.
and just like with date offsets: if the argument is followed by one of the suffixes y, mo, w, d, h, or mi, the interval is measured in years, months, weeks, days, hours, or minutes respectively. no suffix? seconds. always seconds. π°οΈ
π GENERATED KEYS π
when dnssec-keygen finishes successfully, it prints a string to standard output that looks like Knnnn.+aaa+iiiii. that's the identification string for the key it just generated β¨ here's what's in it:
nnnnis the key name.aaais the numeric representation of the algorithm.iiiiiis the key identifier (or footprint).
dnssec-keygen also creates two files, with names based on that printed string:
Knnnn.+aaa+iiiii.keyβ contains the public key πKnnnn.+aaa+iiiii.privateβ contains the private key π
the .key file contains a DNSKEY or KEY record. when a zone is being signed by named or dnssec-signzone -S, DNSKEY records get included automatically. in other cases, you can insert the .key file into a zone file manually, or with an $INCLUDE statement. easy π
the .private file contains algorithm-specific fields. and for obvious security reasons, this file does not have general read permission. do not touch. do not share. do not screenshot. π
π EXAMPLE π
ok let's actually do this. to generate an ECDSAP256SHA256 zone-signing key for the zone example.com, you issue:
dnssec-keygen -a ECDSAP256SHA256 example.com
and the command prints a string of the form:
Kexample.com.+013+26160
in this example, dnssec-keygen creates the files Kexample.com.+013+26160.key and Kexample.com.+013+26160.private. boom. you're a cryptographer now π
and to generate a matching key-signing key, you issue:
dnssec-keygen -a ECDSAP256SHA256 -f KSK example.com
literally that easy π¦
π SEE ALSO π
dnssec-signzone(8)- BIND 9 Administrator Reference Manual
- RFC 2539
- RFC 2845
- RFC 4034
go read them, bestie, they're giving lore π
π Author π
Internet Systems Consortium
π Copyright π
2026, Internet Systems Consortium
ok that's the whole page!! this was version 9.20.30, dated 2026-10-12, and it's the DNSSEC-KEYGEN(1) manual page, mwah π go sign some zones, you absolute icon π
π¦ where this page comes from
- alpine 3.22: bind-doc 9.20.30-r0 Β· MPL-2.0
- alpine 3.23: bind-doc 9.20.30-r0 Β· MPL-2.0
- alpine 3.24: bind-doc 9.20.30-r0 Β· MPL-2.0
- nixos 26.05: bind 9.20.30
- nixpkgs unstable: bind 9.20.30
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms