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