1 <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
2 "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"
3 [<!ENTITY mdash "—">]>
5 - Copyright (C) 2004, 2005, 2007-2009 Internet Systems Consortium, Inc. ("ISC")
6 - Copyright (C) 2000-2003 Internet Software Consortium.
8 - Permission to use, copy, modify, and/or distribute this software for any
9 - purpose with or without fee is hereby granted, provided that the above
10 - copyright notice and this permission notice appear in all copies.
12 - THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
13 - REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
14 - AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
15 - INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
16 - LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
17 - OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
18 - PERFORMANCE OF THIS SOFTWARE.
21 <!-- Id: dnssec-keygen.docbook,v 1.33 2009/11/03 21:44:46 each Exp -->
22 <refentry id="man.dnssec-keygen">
24 <date>June 30, 2000</date>
28 <refentrytitle><application>dnssec-keygen</application></refentrytitle>
29 <manvolnum>8</manvolnum>
30 <refmiscinfo>BIND9</refmiscinfo>
34 <refname><application>dnssec-keygen</application></refname>
35 <refpurpose>DNSSEC key generation tool</refpurpose>
45 <holder>Internet Systems Consortium, Inc. ("ISC")</holder>
52 <holder>Internet Software Consortium.</holder>
58 <command>dnssec-keygen</command>
59 <arg><option>-a <replaceable class="parameter">algorithm</replaceable></option></arg>
60 <arg ><option>-b <replaceable class="parameter">keysize</replaceable></option></arg>
61 <arg><option>-n <replaceable class="parameter">nametype</replaceable></option></arg>
62 <arg><option>-3</option></arg>
63 <arg><option>-A <replaceable class="parameter">date/offset</replaceable></option></arg>
64 <arg><option>-C</option></arg>
65 <arg><option>-c <replaceable class="parameter">class</replaceable></option></arg>
66 <arg><option>-D <replaceable class="parameter">date/offset</replaceable></option></arg>
67 <arg><option>-E <replaceable class="parameter">engine</replaceable></option></arg>
68 <arg><option>-e</option></arg>
69 <arg><option>-f <replaceable class="parameter">flag</replaceable></option></arg>
70 <arg><option>-G</option></arg>
71 <arg><option>-g <replaceable class="parameter">generator</replaceable></option></arg>
72 <arg><option>-h</option></arg>
73 <arg><option>-I <replaceable class="parameter">date/offset</replaceable></option></arg>
74 <arg><option>-K <replaceable class="parameter">directory</replaceable></option></arg>
75 <arg><option>-k</option></arg>
76 <arg><option>-P <replaceable class="parameter">date/offset</replaceable></option></arg>
77 <arg><option>-p <replaceable class="parameter">protocol</replaceable></option></arg>
78 <arg><option>-q</option></arg>
79 <arg><option>-R <replaceable class="parameter">date/offset</replaceable></option></arg>
80 <arg><option>-r <replaceable class="parameter">randomdev</replaceable></option></arg>
81 <arg><option>-s <replaceable class="parameter">strength</replaceable></option></arg>
82 <arg><option>-t <replaceable class="parameter">type</replaceable></option></arg>
83 <arg><option>-v <replaceable class="parameter">level</replaceable></option></arg>
84 <arg><option>-z</option></arg>
85 <arg choice="req">name</arg>
90 <title>DESCRIPTION</title>
91 <para><command>dnssec-keygen</command>
92 generates keys for DNSSEC (Secure DNS), as defined in RFC 2535
93 and RFC 4034. It can also generate keys for use with
94 TSIG (Transaction Signatures) as defined in RFC 2845, or TKEY
95 (Transaction Key) as defined in RFC 2930.
98 The <option>name</option> of the key is specified on the command
99 line. For DNSSEC keys, this must match the name of the zone for
100 which the key is being generated.
105 <title>OPTIONS</title>
109 <term>-a <replaceable class="parameter">algorithm</replaceable></term>
112 Selects the cryptographic algorithm. For DNSSEC keys, the value
113 of <option>algorithm</option> must be one of RSAMD5, RSASHA1,
114 DSA, NSEC3RSASHA1, NSEC3DSA, RSASHA256 or RSASHA512.
115 For TSIG/TKEY, the value must
116 be DH (Diffie Hellman), HMAC-MD5, HMAC-SHA1, HMAC-SHA224,
117 HMAC-SHA256, HMAC-SHA384, or HMAC-SHA512. These values are
121 If no algorithm is specified, then RSASHA1 will be used by
122 default, unless the <option>-3</option> option is specified,
123 in which case NSEC3RSASHA1 will be used instead. (If
124 <option>-3</option> is used and an algorithm is specified,
125 that algorithm will be checked for compatibility with NSEC3.)
128 Note 1: that for DNSSEC, RSASHA1 is a mandatory to implement
129 algorithm, and DSA is recommended. For TSIG, HMAC-MD5 is
133 Note 2: DH, HMAC-MD5, and HMAC-SHA1 through HMAC-SHA512
134 automatically set the -T KEY option.
140 <term>-b <replaceable class="parameter">keysize</replaceable></term>
143 Specifies the number of bits in the key. The choice of key
144 size depends on the algorithm used. RSA keys must be
145 between 512 and 2048 bits. Diffie Hellman keys must be between
146 128 and 4096 bits. DSA keys must be between 512 and 1024
147 bits and an exact multiple of 64. HMAC keys must be
148 between 1 and 512 bits.
151 The key size does not need to be specified if using a default
152 algorithm. The default key size is 1024 bits for zone signing
153 keys (ZSK's) and 2048 bits for key signing keys (KSK's,
154 generated with <option>-f KSK</option>). However, if an
155 algorithm is explicitly specified with the <option>-a</option>,
156 then there is no default key size, and the <option>-b</option>
163 <term>-n <replaceable class="parameter">nametype</replaceable></term>
166 Specifies the owner type of the key. The value of
167 <option>nametype</option> must either be ZONE (for a DNSSEC
168 zone key (KEY/DNSKEY)), HOST or ENTITY (for a key associated with
170 USER (for a key associated with a user(KEY)) or OTHER (DNSKEY).
171 These values are case insensitive. Defaults to ZONE for DNSKEY
181 Use an NSEC3-capable algorithm to generate a DNSSEC key.
182 If this option is used and no algorithm is explicitly
183 set on the command line, NSEC3RSASHA1 will be used by
184 default. Note that RSASHA256 and RSASHA512 algorithms
194 Compatibility mode: generates an old-style key, without
195 any metadata. By default, <command>dnssec-keygen</command>
196 will include the key's creation date in the metadata stored
197 with the private key, and other dates may be set there as well
198 (publication date, activation date, etc). Keys that include
199 this data may be incompatible with older versions of BIND; the
200 <option>-C</option> option suppresses them.
206 <term>-c <replaceable class="parameter">class</replaceable></term>
209 Indicates that the DNS record containing the key should have
210 the specified class. If not specified, class IN is used.
216 <term>-E <replaceable class="parameter">engine</replaceable></term>
219 Uses a crypto hardware (OpenSSL engine) for random number
220 and, when supported, key generation. When compiled with PKCS#11
221 support it defaults to pkcs11; the empty name resets it to
231 If generating an RSAMD5/RSASHA1 key, use a large exponent.
237 <term>-f <replaceable class="parameter">flag</replaceable></term>
240 Set the specified flag in the flag field of the KEY/DNSKEY record.
241 The only recognized flags are KSK (Key Signing Key) and REVOKE.
250 Generate a key, but do not publish it or sign with it. This
251 option is incompatible with -P and -A.
257 <term>-g <replaceable class="parameter">generator</replaceable></term>
260 If generating a Diffie Hellman key, use this generator.
261 Allowed values are 2 and 5. If no generator
262 is specified, a known prime from RFC 2539 will be used
263 if possible; otherwise the default is 2.
272 Prints a short summary of the options and arguments to
273 <command>dnssec-keygen</command>.
279 <term>-K <replaceable class="parameter">directory</replaceable></term>
282 Sets the directory in which the key files are to be written.
291 Deprecated in favor of -T KEY.
297 <term>-p <replaceable class="parameter">protocol</replaceable></term>
300 Sets the protocol value for the generated key. The protocol
301 is a number between 0 and 255. The default is 3 (DNSSEC).
302 Other possible values for this argument are listed in
303 RFC 2535 and its successors.
312 Quiet mode: Suppresses unnecessary output, including
313 progress indication. Without this option, when
314 <command>dnssec-keygen</command> is run interactively
315 to generate an RSA or DSA key pair, it will print a string
316 of symbols to <filename>stderr</filename> indicating the
317 progress of the key generation. A '.' indicates that a
318 random number has been found which passed an initial
319 sieve test; '+' means a number has passed a single
320 round of the Miller-Rabin primality test; a space
321 means that the number has passed all the tests and is
328 <term>-r <replaceable class="parameter">randomdev</replaceable></term>
331 Specifies the source of randomness. If the operating
332 system does not provide a <filename>/dev/random</filename>
333 or equivalent device, the default source of randomness
334 is keyboard input. <filename>randomdev</filename>
336 the name of a character device or file containing random
337 data to be used instead of the default. The special value
338 <filename>keyboard</filename> indicates that keyboard
339 input should be used.
345 <term>-s <replaceable class="parameter">strength</replaceable></term>
348 Specifies the strength value of the key. The strength is
349 a number between 0 and 15, and currently has no defined
356 <term>-T <replaceable class="parameter">rrtype</replaceable></term>
359 Specifies the resource record type to use for the key.
360 <option>rrtype</option> must be either DNSKEY or KEY. The
361 default is DNSKEY when using a DNSSEC algorithm, but it can be
362 overridden to KEY for use with SIG(0).
365 Using any TSIG algorithm (HMAC-* or DH) forces this option
372 <term>-t <replaceable class="parameter">type</replaceable></term>
375 Indicates the use of the key. <option>type</option> must be
376 one of AUTHCONF, NOAUTHCONF, NOAUTH, or NOCONF. The default
377 is AUTHCONF. AUTH refers to the ability to authenticate
378 data, and CONF the ability to encrypt data.
384 <term>-v <replaceable class="parameter">level</replaceable></term>
387 Sets the debugging level.
396 <title>TIMING OPTIONS</title>
399 Dates can be expressed in the format YYYYMMDD or YYYYMMDDHHMMSS.
400 If the argument begins with a '+' or '-', it is interpreted as
401 an offset from the present time. For convenience, if such an offset
402 is followed by one of the suffixes 'y', 'mo', 'w', 'd', 'h', or 'mi',
403 then the offset is computed in years (defined as 365 24-hour days,
404 ignoring leap years), months (defined as 30 24-hour days), weeks,
405 days, hours, or minutes, respectively. Without a suffix, the offset
406 is computed in seconds.
411 <term>-P <replaceable class="parameter">date/offset</replaceable></term>
414 Sets the date on which a key is to be published to the zone.
415 After that date, the key will be included in the zone but will
416 not be used to sign it. If not set, and if the -G option has
417 not been used, the default is "now".
423 <term>-A <replaceable class="parameter">date/offset</replaceable></term>
426 Sets the date on which the key is to be activated. After that
427 date, the key will be included in the zone and used to sign
428 it. If not set, and if the -G option has not been used, the
435 <term>-R <replaceable class="parameter">date/offset</replaceable></term>
438 Sets the date on which the key is to be revoked. After that
439 date, the key will be flagged as revoked. It will be included
440 in the zone and will be used to sign it.
446 <term>-I <replaceable class="parameter">date/offset</replaceable></term>
449 Sets the date on which the key is to be retired. After that
450 date, the key will still be included in the zone, but it
451 will not be used to sign it.
457 <term>-D <replaceable class="parameter">date/offset</replaceable></term>
460 Sets the date on which the key is to be deleted. After that
461 date, the key will no longer be included in the zone. (It
462 may remain in the key repository, however.)
471 <title>GENERATED KEYS</title>
473 When <command>dnssec-keygen</command> completes
475 it prints a string of the form <filename>Knnnn.+aaa+iiiii</filename>
476 to the standard output. This is an identification string for
477 the key it has generated.
481 <para><filename>nnnn</filename> is the key name.
485 <para><filename>aaa</filename> is the numeric representation
491 <para><filename>iiiii</filename> is the key identifier (or
496 <para><command>dnssec-keygen</command>
497 creates two files, with names based
498 on the printed string. <filename>Knnnn.+aaa+iiiii.key</filename>
499 contains the public key, and
500 <filename>Knnnn.+aaa+iiiii.private</filename> contains the
505 The <filename>.key</filename> file contains a DNS KEY record
507 can be inserted into a zone file (directly or with a $INCLUDE
511 The <filename>.private</filename> file contains
513 fields. For obvious security reasons, this file does not have
514 general read permission.
517 Both <filename>.key</filename> and <filename>.private</filename>
518 files are generated for symmetric encryption algorithms such as
519 HMAC-MD5, even though the public and private key are equivalent.
524 <title>EXAMPLE</title>
526 To generate a 768-bit DSA key for the domain
527 <userinput>example.com</userinput>, the following command would be
530 <para><userinput>dnssec-keygen -a DSA -b 768 -n ZONE example.com</userinput>
533 The command would print a string of the form:
535 <para><userinput>Kexample.com.+003+26160</userinput>
538 In this example, <command>dnssec-keygen</command> creates
539 the files <filename>Kexample.com.+003+26160.key</filename>
541 <filename>Kexample.com.+003+26160.private</filename>.
546 <title>SEE ALSO</title>
548 <refentrytitle>dnssec-signzone</refentrytitle><manvolnum>8</manvolnum>
550 <citetitle>BIND 9 Administrator Reference Manual</citetitle>,
551 <citetitle>RFC 2539</citetitle>,
552 <citetitle>RFC 2845</citetitle>,
553 <citetitle>RFC 4034</citetitle>.
558 <title>AUTHOR</title>
559 <para><corpauthor>Internet Systems Consortium</corpauthor>