Update repub branch u/fanf2/patch to rebasing branch u/fanf2/rebasing revision v9_13_...
[ipreg/bind9.git] / bin / dnssec / dnssec-keygen.docbook
1 <!--
2 - Copyright (C) Internet Systems Consortium, Inc. ("ISC")
3 -
4 - This Source Code Form is subject to the terms of the Mozilla Public
5 - License, v. 2.0. If a copy of the MPL was not distributed with this
6 - file, You can obtain one at http://mozilla.org/MPL/2.0/.
7 -
8 - See the COPYRIGHT file distributed with this work for additional
9 - information regarding copyright ownership.
10 -->
11
12 <!-- Converted by db4-upgrade version 1.0 -->
13 <refentry xmlns:db="http://docbook.org/ns/docbook" version="5.0" xml:id="man.dnssec-keygen">
14 <info>
15 <date>2014-02-06</date>
16 </info>
17 <refentryinfo>
18 <date>August 21, 2015</date>
19 <corpname>ISC</corpname>
20 <corpauthor>Internet Systems Consortium, Inc.</corpauthor>
21 </refentryinfo>
22
23 <refmeta>
24 <refentrytitle><application>dnssec-keygen</application></refentrytitle>
25 <manvolnum>8</manvolnum>
26 <refmiscinfo>BIND9</refmiscinfo>
27 </refmeta>
28
29 <refnamediv>
30 <refname><application>dnssec-keygen</application></refname>
31 <refpurpose>DNSSEC key generation tool</refpurpose>
32 </refnamediv>
33
34 <docinfo>
35 <copyright>
36 <year>2000</year>
37 <year>2001</year>
38 <year>2002</year>
39 <year>2003</year>
40 <year>2004</year>
41 <year>2005</year>
42 <year>2007</year>
43 <year>2008</year>
44 <year>2009</year>
45 <year>2010</year>
46 <year>2011</year>
47 <year>2012</year>
48 <year>2014</year>
49 <year>2015</year>
50 <year>2016</year>
51 <year>2017</year>
52 <year>2018</year>
53 <year>2019</year>
54 <holder>Internet Systems Consortium, Inc. ("ISC")</holder>
55 </copyright>
56 </docinfo>
57
58 <refsynopsisdiv>
59 <cmdsynopsis sepchar=" ">
60 <command>dnssec-keygen</command>
61 <arg choice="opt" rep="norepeat"><option>-3</option></arg>
62 <arg choice="opt" rep="norepeat"><option>-A <replaceable class="parameter">date/offset</replaceable></option></arg>
63 <arg rep="norepeat"><option>-a <replaceable class="parameter">algorithm</replaceable></option></arg>
64 <arg choice="opt" rep="norepeat"><option>-b <replaceable class="parameter">keysize</replaceable></option></arg>
65 <arg choice="opt" rep="norepeat"><option>-C</option></arg>
66 <arg choice="opt" rep="norepeat"><option>-c <replaceable class="parameter">class</replaceable></option></arg>
67 <arg choice="opt" rep="norepeat"><option>-D <replaceable class="parameter">date/offset</replaceable></option></arg>
68 <arg choice="opt" rep="norepeat"><option>-D sync <replaceable class="parameter">date/offset</replaceable></option></arg>
69 <arg choice="opt" rep="norepeat"><option>-E <replaceable class="parameter">engine</replaceable></option></arg>
70 <arg choice="opt" rep="norepeat"><option>-f <replaceable class="parameter">flag</replaceable></option></arg>
71 <arg choice="opt" rep="norepeat"><option>-G</option></arg>
72 <arg choice="opt" rep="norepeat"><option>-g <replaceable class="parameter">generator</replaceable></option></arg>
73 <arg choice="opt" rep="norepeat"><option>-h</option></arg>
74 <arg choice="opt" rep="norepeat"><option>-I <replaceable class="parameter">date/offset</replaceable></option></arg>
75 <arg choice="opt" rep="norepeat"><option>-i <replaceable class="parameter">interval</replaceable></option></arg>
76 <arg choice="opt" rep="norepeat"><option>-K <replaceable class="parameter">directory</replaceable></option></arg>
77 <arg choice="opt" rep="norepeat"><option>-k</option></arg>
78 <arg choice="opt" rep="norepeat"><option>-L <replaceable class="parameter">ttl</replaceable></option></arg>
79 <arg choice="opt" rep="norepeat"><option>-n <replaceable class="parameter">nametype</replaceable></option></arg>
80 <arg choice="opt" rep="norepeat"><option>-P <replaceable class="parameter">date/offset</replaceable></option></arg>
81 <arg choice="opt" rep="norepeat"><option>-P sync <replaceable class="parameter">date/offset</replaceable></option></arg>
82 <arg choice="opt" rep="norepeat"><option>-p <replaceable class="parameter">protocol</replaceable></option></arg>
83 <arg choice="opt" rep="norepeat"><option>-q</option></arg>
84 <arg choice="opt" rep="norepeat"><option>-R <replaceable class="parameter">date/offset</replaceable></option></arg>
85 <arg choice="opt" rep="norepeat"><option>-S <replaceable class="parameter">key</replaceable></option></arg>
86 <arg choice="opt" rep="norepeat"><option>-s <replaceable class="parameter">strength</replaceable></option></arg>
87 <arg choice="opt" rep="norepeat"><option>-t <replaceable class="parameter">type</replaceable></option></arg>
88 <arg choice="opt" rep="norepeat"><option>-V</option></arg>
89 <arg choice="opt" rep="norepeat"><option>-v <replaceable class="parameter">level</replaceable></option></arg>
90 <arg choice="req" rep="norepeat">name</arg>
91 </cmdsynopsis>
92 </refsynopsisdiv>
93
94 <refsection><info><title>DESCRIPTION</title></info>
95
96 <para><command>dnssec-keygen</command>
97 generates keys for DNSSEC (Secure DNS), as defined in RFC 2535
98 and RFC 4034. It can also generate keys for use with
99 TSIG (Transaction Signatures) as defined in RFC 2845, or TKEY
100 (Transaction Key) as defined in RFC 2930.
101 </para>
102 <para>
103 The <option>name</option> of the key is specified on the command
104 line. For DNSSEC keys, this must match the name of the zone for
105 which the key is being generated.
106 </para>
107 <para>
108 The <command>dnssec-keymgr</command> command acts as a wrapper
109 around <command>dnssec-keygen</command>, generating and updating keys
110 as needed to enforce defined security policies such as key rollover
111 scheduling. Using <command>dnssec-keymgr</command> may be preferable
112 to direct use of <command>dnssec-keygen</command>.
113 </para>
114 </refsection>
115
116 <refsection><info><title>OPTIONS</title></info>
117
118
119 <variablelist>
120
121 <varlistentry>
122 <term>-3</term>
123 <listitem>
124 <para>
125 Use an NSEC3-capable algorithm to generate a DNSSEC key.
126 If this option is used with an algorithm that has both
127 NSEC and NSEC3 versions, then the NSEC3 version will be
128 used; for example, <command>dnssec-keygen -3a RSASHA1</command>
129 specifies the NSEC3RSASHA1 algorithm.
130 </para>
131 </listitem>
132 </varlistentry>
133
134 <varlistentry>
135 <term>-a <replaceable class="parameter">algorithm</replaceable></term>
136 <listitem>
137 <para>
138 Selects the cryptographic algorithm. For DNSSEC keys, the value
139 of <option>algorithm</option> must be one of RSASHA1,
140 NSEC3RSASHA1, RSASHA256, RSASHA512,
141 ECDSAP256SHA256, ECDSAP384SHA384, ED25519 or ED448. For
142 TKEY, the value must be DH (Diffie Hellman); specifying
143 his value will automatically set the <option>-T KEY</option>
144 option as well.
145 </para>
146 <para>
147 These values are case insensitive. In some cases, abbreviations
148 are supported, such as ECDSA256 for ECDSAP256SHA256 and
149 ECDSA384 for ECDSAP384SHA384. If RSASHA1 is specified
150 along with the <option>-3</option> option, then NSEC3RSASHA1
151 will be used instead.
152 </para>
153 <para>
154 This parameter <emphasis>must</emphasis> be specified except
155 when using the <option>-S</option> option, which copies the
156 algorithm from the predecessor key.
157 </para>
158 <para>
159 In prior releases, HMAC algorithms could be generated for
160 use as TSIG keys, but that feature has been removed as of
161 BIND 9.13.0. Use <command>tsig-keygen</command> to generate
162 TSIG keys.
163 </para>
164 </listitem>
165 </varlistentry>
166
167 <varlistentry>
168 <term>-b <replaceable class="parameter">keysize</replaceable></term>
169 <listitem>
170 <para>
171 Specifies the number of bits in the key. The choice of key
172 size depends on the algorithm used. RSA keys must be
173 between 1024 and 4096 bits. Diffie Hellman keys must be between
174 128 and 4096 bits. Elliptic curve algorithms don't need this
175 parameter.
176 </para>
177 <para>
178 If the key size is not specified, some algorithms have
179 pre-defined defaults. For example, RSA keys for use as
180 DNSSEC zone signing keys have a default size of 1024 bits;
181 RSA keys for use as key signing keys (KSKs, generated with
182 <option>-f KSK</option>) default to 2048 bits.
183 </para>
184 </listitem>
185 </varlistentry>
186
187 <varlistentry>
188 <term>-C</term>
189 <listitem>
190 <para>
191 Compatibility mode: generates an old-style key, without any
192 timing metadata. By default, <command>dnssec-keygen</command>
193 will include the key's creation date in the metadata stored with
194 the private key, and other dates may be set there as well
195 (publication date, activation date, etc). Keys that include this
196 data may be incompatible with older versions of BIND; the
197 <option>-C</option> option suppresses them.
198 </para>
199 </listitem>
200 </varlistentry>
201
202 <varlistentry>
203 <term>-c <replaceable class="parameter">class</replaceable></term>
204 <listitem>
205 <para>
206 Indicates that the DNS record containing the key should have
207 the specified class. If not specified, class IN is used.
208 </para>
209 </listitem>
210 </varlistentry>
211
212 <varlistentry>
213 <term>-E <replaceable class="parameter">engine</replaceable></term>
214 <listitem>
215 <para>
216 Specifies the cryptographic hardware to use, when applicable.
217 </para>
218 <para>
219 When BIND is built with OpenSSL PKCS#11 support, this defaults
220 to the string "pkcs11", which identifies an OpenSSL engine
221 that can drive a cryptographic accelerator or hardware service
222 module. When BIND is built with native PKCS#11 cryptography
223 (--enable-native-pkcs11), it defaults to the path of the PKCS#11
224 provider library specified via "--with-pkcs11".
225 </para>
226 </listitem>
227 </varlistentry>
228
229 <varlistentry>
230 <term>-f <replaceable class="parameter">flag</replaceable></term>
231 <listitem>
232 <para>
233 Set the specified flag in the flag field of the KEY/DNSKEY record.
234 The only recognized flags are KSK (Key Signing Key) and REVOKE.
235 </para>
236 </listitem>
237 </varlistentry>
238
239 <varlistentry>
240 <term>-G</term>
241 <listitem>
242 <para>
243 Generate a key, but do not publish it or sign with it. This
244 option is incompatible with -P and -A.
245 </para>
246 </listitem>
247 </varlistentry>
248
249 <varlistentry>
250 <term>-g <replaceable class="parameter">generator</replaceable></term>
251 <listitem>
252 <para>
253 If generating a Diffie Hellman key, use this generator.
254 Allowed values are 2 and 5. If no generator
255 is specified, a known prime from RFC 2539 will be used
256 if possible; otherwise the default is 2.
257 </para>
258 </listitem>
259 </varlistentry>
260
261 <varlistentry>
262 <term>-h</term>
263 <listitem>
264 <para>
265 Prints a short summary of the options and arguments to
266 <command>dnssec-keygen</command>.
267 </para>
268 </listitem>
269 </varlistentry>
270
271 <varlistentry>
272 <term>-K <replaceable class="parameter">directory</replaceable></term>
273 <listitem>
274 <para>
275 Sets the directory in which the key files are to be written.
276 </para>
277 </listitem>
278 </varlistentry>
279
280 <varlistentry>
281 <term>-L <replaceable class="parameter">ttl</replaceable></term>
282 <listitem>
283 <para>
284 Sets the default TTL to use for this key when it is converted
285 into a DNSKEY RR. If the key is imported into a zone,
286 this is the TTL that will be used for it, unless there was
287 already a DNSKEY RRset in place, in which case the existing TTL
288 would take precedence. If this value is not set and there
289 is no existing DNSKEY RRset, the TTL will default to the
290 SOA TTL. Setting the default TTL to <literal>0</literal>
291 or <literal>none</literal> is the same as leaving it unset.
292 </para>
293 </listitem>
294 </varlistentry>
295
296 <varlistentry>
297 <term>-n <replaceable class="parameter">nametype</replaceable></term>
298 <listitem>
299 <para>
300 Specifies the owner type of the key. The value of
301 <option>nametype</option> must either be ZONE (for a DNSSEC
302 zone key (KEY/DNSKEY)), HOST or ENTITY (for a key associated
303 with a host (KEY)), USER (for a key associated with a
304 user(KEY)) or OTHER (DNSKEY). These values are case
305 insensitive. Defaults to ZONE for DNSKEY generation.
306 </para>
307 </listitem>
308 </varlistentry>
309
310 <varlistentry>
311 <term>-p <replaceable class="parameter">protocol</replaceable></term>
312 <listitem>
313 <para>
314 Sets the protocol value for the generated key, for use
315 with <option>-T KEY</option>. The protocol is a number between 0
316 and 255. The default is 3 (DNSSEC). Other possible values for
317 this argument are listed in RFC 2535 and its successors.
318 </para>
319 </listitem>
320 </varlistentry>
321
322 <varlistentry>
323 <term>-q</term>
324 <listitem>
325 <para>
326 Quiet mode: Suppresses unnecessary output, including
327 progress indication. Without this option, when
328 <command>dnssec-keygen</command> is run interactively
329 to generate an RSA or DSA key pair, it will print a string
330 of symbols to <filename>stderr</filename> indicating the
331 progress of the key generation. A '.' indicates that a
332 random number has been found which passed an initial
333 sieve test; '+' means a number has passed a single
334 round of the Miller-Rabin primality test; a space
335 means that the number has passed all the tests and is
336 a satisfactory key.
337 </para>
338 </listitem>
339 </varlistentry>
340
341 <varlistentry>
342 <term>-S <replaceable class="parameter">key</replaceable></term>
343 <listitem>
344 <para>
345 Create a new key which is an explicit successor to an
346 existing key. The name, algorithm, size, and type of the
347 key will be set to match the existing key. The activation
348 date of the new key will be set to the inactivation date of
349 the existing one. The publication date will be set to the
350 activation date minus the prepublication interval, which
351 defaults to 30 days.
352 </para>
353 </listitem>
354 </varlistentry>
355
356 <varlistentry>
357 <term>-s <replaceable class="parameter">strength</replaceable></term>
358 <listitem>
359 <para>
360 Specifies the strength value of the key. The strength is
361 a number between 0 and 15, and currently has no defined
362 purpose in DNSSEC.
363 </para>
364 </listitem>
365 </varlistentry>
366
367 <varlistentry>
368 <term>-T <replaceable class="parameter">rrtype</replaceable></term>
369 <listitem>
370 <para>
371 Specifies the resource record type to use for the key.
372 <option>rrtype</option> must be either DNSKEY or KEY. The
373 default is DNSKEY when using a DNSSEC algorithm, but it can be
374 overridden to KEY for use with SIG(0).
375 </para>
376 </listitem>
377 </varlistentry>
378
379 <varlistentry>
380 <term>-t <replaceable class="parameter">type</replaceable></term>
381 <listitem>
382 <para>
383 Indicates the use of the key, for use with <option>-T
384 KEY</option>. <option>type</option> must be one of AUTHCONF,
385 NOAUTHCONF, NOAUTH, or NOCONF. The default is AUTHCONF. AUTH
386 refers to the ability to authenticate data, and CONF the ability
387 to encrypt data.
388 </para>
389 </listitem>
390 </varlistentry>
391
392 <varlistentry>
393 <term>-V</term>
394 <listitem>
395 <para>
396 Prints version information.
397 </para>
398 </listitem>
399 </varlistentry>
400
401 <varlistentry>
402 <term>-v <replaceable class="parameter">level</replaceable></term>
403 <listitem>
404 <para>
405 Sets the debugging level.
406 </para>
407 </listitem>
408 </varlistentry>
409
410 </variablelist>
411 </refsection>
412
413 <refsection><info><title>TIMING OPTIONS</title></info>
414
415
416 <para>
417 Dates can be expressed in the format YYYYMMDD or YYYYMMDDHHMMSS.
418 If the argument begins with a '+' or '-', it is interpreted as
419 an offset from the present time. For convenience, if such an offset
420 is followed by one of the suffixes 'y', 'mo', 'w', 'd', 'h', or 'mi',
421 then the offset is computed in years (defined as 365 24-hour days,
422 ignoring leap years), months (defined as 30 24-hour days), weeks,
423 days, hours, or minutes, respectively. Without a suffix, the offset
424 is computed in seconds. To explicitly prevent a date from being
425 set, use 'none' or 'never'.
426 </para>
427
428 <variablelist>
429 <varlistentry>
430 <term>-P <replaceable class="parameter">date/offset</replaceable></term>
431 <listitem>
432 <para>
433 Sets the date on which a key is to be published to the zone.
434 After that date, the key will be included in the zone but will
435 not be used to sign it. If not set, and if the -G option has
436 not been used, the default is "now".
437 </para>
438 </listitem>
439 </varlistentry>
440
441 <varlistentry>
442 <term>-P sync <replaceable class="parameter">date/offset</replaceable></term>
443 <listitem>
444 <para>
445 Sets the date on which CDS and CDNSKEY records that match this
446 key are to be published to the zone.
447 </para>
448 </listitem>
449 </varlistentry>
450
451 <varlistentry>
452 <term>-A <replaceable class="parameter">date/offset</replaceable></term>
453 <listitem>
454 <para>
455 Sets the date on which the key is to be activated. After that
456 date, the key will be included in the zone and used to sign
457 it. If not set, and if the -G option has not been used, the
458 default is "now". If set, if and -P is not set, then
459 the publication date will be set to the activation date
460 minus the prepublication interval.
461 </para>
462 </listitem>
463 </varlistentry>
464
465 <varlistentry>
466 <term>-R <replaceable class="parameter">date/offset</replaceable></term>
467 <listitem>
468 <para>
469 Sets the date on which the key is to be revoked. After that
470 date, the key will be flagged as revoked. It will be included
471 in the zone and will be used to sign it.
472 </para>
473 </listitem>
474 </varlistentry>
475
476 <varlistentry>
477 <term>-I <replaceable class="parameter">date/offset</replaceable></term>
478 <listitem>
479 <para>
480 Sets the date on which the key is to be retired. After that
481 date, the key will still be included in the zone, but it
482 will not be used to sign it.
483 </para>
484 </listitem>
485 </varlistentry>
486
487 <varlistentry>
488 <term>-D <replaceable class="parameter">date/offset</replaceable></term>
489 <listitem>
490 <para>
491 Sets the date on which the key is to be deleted. After that
492 date, the key will no longer be included in the zone. (It
493 may remain in the key repository, however.)
494 </para>
495 </listitem>
496 </varlistentry>
497
498 <varlistentry>
499 <term>-D sync <replaceable class="parameter">date/offset</replaceable></term>
500 <listitem>
501 <para>
502 Sets the date on which the CDS and CDNSKEY records that match this
503 key are to be deleted.
504 </para>
505 </listitem>
506 </varlistentry>
507
508 <varlistentry>
509 <term>-i <replaceable class="parameter">interval</replaceable></term>
510 <listitem>
511 <para>
512 Sets the prepublication interval for a key. If set, then
513 the publication and activation dates must be separated by at least
514 this much time. If the activation date is specified but the
515 publication date isn't, then the publication date will default
516 to this much time before the activation date; conversely, if
517 the publication date is specified but activation date isn't,
518 then activation will be set to this much time after publication.
519 </para>
520 <para>
521 If the key is being created as an explicit successor to another
522 key, then the default prepublication interval is 30 days;
523 otherwise it is zero.
524 </para>
525 <para>
526 As with date offsets, if the argument is followed by one of
527 the suffixes 'y', 'mo', 'w', 'd', 'h', or 'mi', then the
528 interval is measured in years, months, weeks, days, hours,
529 or minutes, respectively. Without a suffix, the interval is
530 measured in seconds.
531 </para>
532 </listitem>
533 </varlistentry>
534
535 </variablelist>
536 </refsection>
537
538
539 <refsection><info><title>GENERATED KEYS</title></info>
540
541 <para>
542 When <command>dnssec-keygen</command> completes
543 successfully,
544 it prints a string of the form <filename>Knnnn.+aaa+iiiii</filename>
545 to the standard output. This is an identification string for
546 the key it has generated.
547 </para>
548 <itemizedlist>
549 <listitem>
550 <para><filename>nnnn</filename> is the key name.
551 </para>
552 </listitem>
553 <listitem>
554 <para><filename>aaa</filename> is the numeric representation
555 of the
556 algorithm.
557 </para>
558 </listitem>
559 <listitem>
560 <para><filename>iiiii</filename> is the key identifier (or
561 footprint).
562 </para>
563 </listitem>
564 </itemizedlist>
565 <para><command>dnssec-keygen</command>
566 creates two files, with names based
567 on the printed string. <filename>Knnnn.+aaa+iiiii.key</filename>
568 contains the public key, and
569 <filename>Knnnn.+aaa+iiiii.private</filename> contains the
570 private
571 key.
572 </para>
573 <para>
574 The <filename>.key</filename> file contains a DNSKEY or KEY record.
575 When a zone is being signed by <command>named</command>
576 or <command>dnssec-signzone</command> <option>-S</option>, DNSKEY
577 records are included automatically. In other cases,
578 the <filename>.key</filename> file can be inserted into a zone file
579 manually or with a <userinput>$INCLUDE</userinput> statement.
580 </para>
581 <para>
582 The <filename>.private</filename> file contains
583 algorithm-specific
584 fields. For obvious security reasons, this file does not have
585 general read permission.
586 </para>
587 </refsection>
588
589 <refsection><info><title>EXAMPLE</title></info>
590
591 <para>
592 To generate an ECDSAP256SHA256 zone-signing key for the zone
593 <userinput>example.com</userinput>, issue the command:
594 </para>
595 <para>
596 <userinput>dnssec-keygen -a ECDSAP256SHA256 example.com</userinput>
597 </para>
598 <para>
599 The command would print a string of the form:
600 </para>
601 <para><userinput>Kexample.com.+013+26160</userinput>
602 </para>
603 <para>
604 In this example, <command>dnssec-keygen</command> creates
605 the files <filename>Kexample.com.+013+26160.key</filename>
606 and
607 <filename>Kexample.com.+013+26160.private</filename>.
608 </para>
609 <para>
610 To generate a matching key-signing key, issue the command:
611 </para>
612 <para>
613 <userinput>dnssec-keygen -a ECDSAP256SHA256 -f KSK example.com</userinput>
614 </para>
615 </refsection>
616
617 <refsection><info><title>SEE ALSO</title></info>
618
619 <para><citerefentry>
620 <refentrytitle>dnssec-signzone</refentrytitle><manvolnum>8</manvolnum>
621 </citerefentry>,
622 <citetitle>BIND 9 Administrator Reference Manual</citetitle>,
623 <citetitle>RFC 2539</citetitle>,
624 <citetitle>RFC 2845</citetitle>,
625 <citetitle>RFC 4034</citetitle>.
626 </para>
627 </refsection>
628
629 </refentry>