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