Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
1 '\" t
2 .\" Title: CERTUTIL
3 .\" Author: [see the "Authors" section]
4 .\" Generator: DocBook XSL Stylesheets v1.78.1 <http://docbook.sf.net/>
5 .\" Date: 5 June 2014
6 .\" Manual: NSS Security Tools
7 .\" Source: nss-tools
8 .\" Language: English
9 .\"
10 .TH "CERTUTIL" "1" "5 June 2014" "nss-tools" "NSS Security Tools"
11 .\" -----------------------------------------------------------------
12 .\" * Define some portability stuff
13 .\" -----------------------------------------------------------------
14 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
15 .\" http://bugs.debian.org/507673
16 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
17 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
18 .ie \n(.g .ds Aq \(aq
19 .el .ds Aq '
20 .\" -----------------------------------------------------------------
21 .\" * set default formatting
22 .\" -----------------------------------------------------------------
23 .\" disable hyphenation
24 .nh
25 .\" disable justification (adjust text to left margin only)
26 .ad l
27 .\" -----------------------------------------------------------------
28 .\" * MAIN CONTENT STARTS HERE *
29 .\" -----------------------------------------------------------------
30 .SH "NAME"
31 certutil \- Manage keys and certificate in both NSS databases and other NSS tokens
32 .SH "SYNOPSIS"
33 .HP \w'\fBcertutil\fR\ 'u
34 \fBcertutil\fR [\fIoptions\fR] [[\fIarguments\fR]]
35 .SH "STATUS"
36 .PP
37 This documentation is still work in progress\&. Please contribute to the initial review in
38 \m[blue]\fBMozilla NSS bug 836477\fR\m[]\&\s-2\u[1]\d\s+2
39 .SH "DESCRIPTION"
40 .PP
41 The Certificate Database Tool,
42 \fBcertutil\fR, is a command\-line utility that can create and modify certificate and key databases\&. It can specifically list, generate, modify, or delete certificates, create or change the password, generate new public and private key pairs, display the contents of the key database, or delete key pairs within the key database\&.
43 .PP
44 Certificate issuance, part of the key and certificate management process, requires that keys and certificates be created in the key database\&. This document discusses certificate and key database management\&. For information on the security module database management, see the
45 \fBmodutil\fR
46 manpage\&.
47 .SH "COMMAND OPTIONS AND ARGUMENTS"
48 .PP
49 Running
50 \fBcertutil\fR
51 always requires one and only one command option to specify the type of certificate operation\&. Each command option may take zero or more arguments\&. The command option
52 \fB\-H\fR
53 will list all the command options and their relevant arguments\&.
54 .PP
55 \fBCommand Options\fR
56 .PP
57 \-A
58 .RS 4
59 Add an existing certificate to a certificate database\&. The certificate database should already exist; if one is not present, this command option will initialize one by default\&.
60 .RE
61 .PP
62 \-B
63 .RS 4
64 Run a series of commands from the specified batch file\&. This requires the
65 \fB\-i\fR
66 argument\&.
67 .RE
68 .PP
69 \-C
70 .RS 4
71 Create a new binary certificate file from a binary certificate request file\&. Use the
72 \fB\-i\fR
73 argument to specify the certificate request file\&. If this argument is not used,
74 \fBcertutil\fR
75 prompts for a filename\&.
76 .RE
77 .PP
78 \-D
79 .RS 4
80 Delete a certificate from the certificate database\&.
81 .RE
82 .PP
83 \-E
84 .RS 4
85 Add an email certificate to the certificate database\&.
86 .RE
87 .PP
88 \-F
89 .RS 4
90 Delete a private key from a key database\&. Specify the key to delete with the \-n argument\&. Specify the database from which to delete the key with the
91 \fB\-d\fR
92 argument\&. Use the
93 \fB\-k\fR
94 argument to specify explicitly whether to delete a DSA, RSA, or ECC key\&. If you don\*(Aqt use the
95 \fB\-k\fR
96 argument, the option looks for an RSA key matching the specified nickname\&.
97 .sp
98 When you delete keys, be sure to also remove any certificates associated with those keys from the certificate database, by using \-D\&. Some smart cards do not let you remove a public key you have generated\&. In such a case, only the private key is deleted from the key pair\&. You can display the public key with the command certutil \-K \-h tokenname\&.
99 .RE
100 .PP
101 \-G
102 .RS 4
103 Generate a new public and private key pair within a key database\&. The key database should already exist; if one is not present, this command option will initialize one by default\&. Some smart cards can store only one key pair\&. If you create a new key pair for such a card, the previous pair is overwritten\&.
104 .RE
105 .PP
106 \-H
107 .RS 4
108 Display a list of the command options and arguments\&.
109 .RE
110 .PP
111 \-K
112 .RS 4
113 List the key ID of keys in the key database\&. A key ID is the modulus of the RSA key or the publicValue of the DSA key\&. IDs are displayed in hexadecimal ("0x" is not shown)\&.
114 .RE
115 .PP
116 \-L
117 .RS 4
118 List all the certificates, or display information about a named certificate, in a certificate database\&. Use the \-h tokenname argument to specify the certificate database on a particular hardware or software token\&.
119 .RE
120 .PP
121 \-M
122 .RS 4
123 Modify a certificate\*(Aqs trust attributes using the values of the \-t argument\&.
124 .RE
125 .PP
126 \-N
127 .RS 4
128 Create new certificate and key databases\&.
129 .RE
130 .PP
131 \-O
132 .RS 4
133 Print the certificate chain\&.
134 .RE
135 .PP
136 \-R
137 .RS 4
138 Create a certificate request file that can be submitted to a Certificate Authority (CA) for processing into a finished certificate\&. Output defaults to standard out unless you use \-o output\-file argument\&. Use the \-a argument to specify ASCII output\&.
139 .RE
140 .PP
141 \-S
142 .RS 4
143 Create an individual certificate and add it to a certificate database\&.
144 .RE
145 .PP
146 \-T
147 .RS 4
148 Reset the key database or token\&.
149 .RE
150 .PP
151 \-U
152 .RS 4
153 List all available modules or print a single named module\&.
154 .RE
155 .PP
156 \-V
157 .RS 4
158 Check the validity of a certificate and its attributes\&.
159 .RE
160 .PP
161 \-W
162 .RS 4
163 Change the password to a key database\&.
164 .RE
165 .PP
166 \-\-merge
167 .RS 4
168 Merge two databases into one\&.
169 .RE
170 .PP
171 \-\-upgrade\-merge
172 .RS 4
173 Upgrade an old database and merge it into a new database\&. This is used to migrate legacy NSS databases (cert8\&.db
174 and
175 key3\&.db) into the newer SQLite databases (cert9\&.db
176 and
177 key4\&.db)\&.
178 .RE
179 .PP
180 \fBArguments\fR
181 .PP
182 Arguments modify a command option and are usually lower case, numbers, or symbols\&.
183 .PP
184 \-a
185 .RS 4
186 Use ASCII format or allow the use of ASCII format for input or output\&. This formatting follows RFC 1113\&. For certificate requests, ASCII output defaults to standard output unless redirected\&.
187 .RE
188 .PP
189 \-b validity\-time
190 .RS 4
191 Specify a time at which a certificate is required to be valid\&. Use when checking certificate validity with the
192 \fB\-V\fR
193 option\&. The format of the
194 \fIvalidity\-time\fR
195 argument is
196 \fIYYMMDDHHMMSS[+HHMM|\-HHMM|Z]\fR, which allows offsets to be set relative to the validity end time\&. Specifying seconds (\fISS\fR) is optional\&. When specifying an explicit time, use a Z at the end of the term,
197 \fIYYMMDDHHMMSSZ\fR, to close it\&. When specifying an offset time, use
198 \fIYYMMDDHHMMSS+HHMM\fR
199 or
200 \fIYYMMDDHHMMSS\-HHMM\fR
201 for adding or subtracting time, respectively\&.
202 .sp
203 If this option is not used, the validity check defaults to the current system time\&.
204 .RE
205 .PP
206 \-c issuer
207 .RS 4
208 Identify the certificate of the CA from which a new certificate will derive its authenticity\&. Use the exact nickname or alias of the CA certificate, or use the CA\*(Aqs email address\&. Bracket the issuer string with quotation marks if it contains spaces\&.
209 .RE
210 .PP
211 \-d [prefix]directory
212 .RS 4
213 Specify the database directory containing the certificate and key database files\&.
214 .sp
215 \fBcertutil\fR
216 supports two types of databases: the legacy security databases (cert8\&.db,
217 key3\&.db, and
218 secmod\&.db) and new SQLite databases (cert9\&.db,
219 key4\&.db, and
220 pkcs11\&.txt)\&.
221 .sp
222 NSS recognizes the following prefixes:
223 .sp
224 .RS 4
225 .ie n \{\
226 \h'-04'\(bu\h'+03'\c
227 .\}
228 .el \{\
229 .sp -1
230 .IP \(bu 2.3
231 .\}
232 \fBsql:\fR
233 requests the newer database
234 .RE
235 .sp
236 .RS 4
237 .ie n \{\
238 \h'-04'\(bu\h'+03'\c
239 .\}
240 .el \{\
241 .sp -1
242 .IP \(bu 2.3
243 .\}
244 \fBdbm:\fR
245 requests the legacy database
246 .RE
247 .sp
248 If no prefix is specified the default type is retrieved from NSS_DEFAULT_DB_TYPE\&. If NSS_DEFAULT_DB_TYPE is not set then
249 \fBdbm:\fR
250 is the default\&.
251 .RE
252 .PP
253 \-e
254 .RS 4
255 Check a certificate\*(Aqs signature during the process of validating a certificate\&.
256 .RE
257 .PP
258 \-\-email email\-address
259 .RS 4
260 Specify the email address of a certificate to list\&. Used with the \-L command option\&.
261 .RE
262 .PP
263 \-f password\-file
264 .RS 4
265 Specify a file that will automatically supply the password to include in a certificate or to access a certificate database\&. This is a plain\-text file containing one password\&. Be sure to prevent unauthorized access to this file\&.
266 .RE
267 .PP
268 \-g keysize
269 .RS 4
270 Set a key size to use when generating new public and private key pairs\&. The minimum is 512 bits and the maximum is 16384 bits\&. The default is 1024 bits\&. Any size between the minimum and maximum is allowed\&.
271 .RE
272 .PP
273 \-h tokenname
274 .RS 4
275 Specify the name of a token to use or act on\&. If not specified the default token is the internal database slot\&.
276 .RE
277 .PP
278 \-i input_file
279 .RS 4
280 Pass an input file to the command\&. Depending on the command option, an input file can be a specific certificate, a certificate request file, or a batch file of commands\&.
281 .RE
282 .PP
283 \-k key\-type\-or\-id
284 .RS 4
285 Specify the type or specific ID of a key\&.
286 .sp
287 The valid key type options are rsa, dsa, ec, or all\&. The default value is rsa\&. Specifying the type of key can avoid mistakes caused by duplicate nicknames\&. Giving a key type generates a new key pair; giving the ID of an existing key reuses that key pair (which is required to renew certificates)\&.
288 .RE
289 .PP
290 \-l
291 .RS 4
292 Display detailed information when validating a certificate with the \-V option\&.
293 .RE
294 .PP
295 \-m serial\-number
296 .RS 4
297 Assign a unique serial number to a certificate being created\&. This operation should be performed by a CA\&. If no serial number is provided a default serial number is made from the current time\&. Serial numbers are limited to integers
298 .RE
299 .PP
300 \-n nickname
301 .RS 4
302 Specify the nickname of a certificate or key to list, create, add to a database, modify, or validate\&. Bracket the nickname string with quotation marks if it contains spaces\&.
303 .RE
304 .PP
305 \-o output\-file
306 .RS 4
307 Specify the output file name for new certificates or binary certificate requests\&. Bracket the output\-file string with quotation marks if it contains spaces\&. If this argument is not used the output destination defaults to standard output\&.
308 .RE
309 .PP
310 \-P dbPrefix
311 .RS 4
312 Specify the prefix used on the certificate and key database file\&. This argument is provided to support legacy servers\&. Most applications do not use a database prefix\&.
313 .RE
314 .PP
315 \-p phone
316 .RS 4
317 Specify a contact telephone number to include in new certificates or certificate requests\&. Bracket this string with quotation marks if it contains spaces\&.
318 .RE
319 .PP
320 \-q pqgfile or curve\-name
321 .RS 4
322 Read an alternate PQG value from the specified file when generating DSA key pairs\&. If this argument is not used,
323 \fBcertutil\fR
324 generates its own PQG value\&. PQG files are created with a separate DSA utility\&.
325 .sp
326 Elliptic curve name is one of the ones from SUITE B: nistp256, nistp384, nistp521
327 .sp
328 If NSS has been compiled with support curves outside of SUITE B: sect163k1, nistk163, sect163r1, sect163r2, nistb163, sect193r1, sect193r2, sect233k1, nistk233, sect233r1, nistb233, sect239k1, sect283k1, nistk283, sect283r1, nistb283, sect409k1, nistk409, sect409r1, nistb409, sect571k1, nistk571, sect571r1, nistb571, secp160k1, secp160r1, secp160r2, secp192k1, secp192r1, nistp192, secp224k1, secp224r1, nistp224, secp256k1, secp256r1, secp384r1, secp521r1, prime192v1, prime192v2, prime192v3, prime239v1, prime239v2, prime239v3, c2pnb163v1, c2pnb163v2, c2pnb163v3, c2pnb176v1, c2tnb191v1, c2tnb191v2, c2tnb191v3, c2pnb208w1, c2tnb239v1, c2tnb239v2, c2tnb239v3, c2pnb272w1, c2pnb304w1, c2tnb359w1, c2pnb368w1, c2tnb431r1, secp112r1, secp112r2, secp128r1, secp128r2, sect113r1, sect113r2 sect131r1, sect131r2
329 .RE
330 .PP
331 \-r
332 .RS 4
333 Display a certificate\*(Aqs binary DER encoding when listing information about that certificate with the \-L option\&.
334 .RE
335 .PP
336 \-s subject
337 .RS 4
338 Identify a particular certificate owner for new certificates or certificate requests\&. Bracket this string with quotation marks if it contains spaces\&. The subject identification format follows RFC #1485\&.
339 .RE
340 .PP
341 \-t trustargs
342 .RS 4
343 Specify the trust attributes to modify in an existing certificate or to apply to a certificate when creating it or adding it to a database\&. There are three available trust categories for each certificate, expressed in the order
344 \fISSL, email, object signing\fR
345 for each trust setting\&. In each category position, use none, any, or all of the attribute codes:
346 .sp
347 .RS 4
348 .ie n \{\
349 \h'-04'\(bu\h'+03'\c
350 .\}
351 .el \{\
352 .sp -1
353 .IP \(bu 2.3
354 .\}
355 \fBp\fR
356 \- Valid peer
357 .RE
358 .sp
359 .RS 4
360 .ie n \{\
361 \h'-04'\(bu\h'+03'\c
362 .\}
363 .el \{\
364 .sp -1
365 .IP \(bu 2.3
366 .\}
367 \fBP\fR
368 \- Trusted peer (implies p)
369 .RE
370 .sp
371 .RS 4
372 .ie n \{\
373 \h'-04'\(bu\h'+03'\c
374 .\}
375 .el \{\
376 .sp -1
377 .IP \(bu 2.3
378 .\}
379 \fBc\fR
380 \- Valid CA
381 .RE
382 .sp
383 .RS 4
384 .ie n \{\
385 \h'-04'\(bu\h'+03'\c
386 .\}
387 .el \{\
388 .sp -1
389 .IP \(bu 2.3
390 .\}
391 \fBT\fR
392 \- Trusted CA (implies c)
393 .RE
394 .sp
395 .RS 4
396 .ie n \{\
397 \h'-04'\(bu\h'+03'\c
398 .\}
399 .el \{\
400 .sp -1
401 .IP \(bu 2.3
402 .\}
403 \fBC\fR
404 \- trusted CA for client authentication (ssl server only)
405 .RE
406 .sp
407 .RS 4
408 .ie n \{\
409 \h'-04'\(bu\h'+03'\c
410 .\}
411 .el \{\
412 .sp -1
413 .IP \(bu 2.3
414 .\}
415 \fBu\fR
416 \- user
417 .RE
418 .sp
419 The attribute codes for the categories are separated by commas, and the entire set of attributes enclosed by quotation marks\&. For example:
420 .sp
421 \fB\-t "TCu,Cu,Tu"\fR
422 .sp
423 Use the \-L option to see a list of the current certificates and trust attributes in a certificate database\&.
424 .RE
425 .PP
426 \-u certusage
427 .RS 4
428 Specify a usage context to apply when validating a certificate with the \-V option\&.
429 .sp
430 The contexts are the following:
431 .sp
432 .RS 4
433 .ie n \{\
434 \h'-04'\(bu\h'+03'\c
435 .\}
436 .el \{\
437 .sp -1
438 .IP \(bu 2.3
439 .\}
440 \fBC\fR
441 (as an SSL client)
442 .RE
443 .sp
444 .RS 4
445 .ie n \{\
446 \h'-04'\(bu\h'+03'\c
447 .\}
448 .el \{\
449 .sp -1
450 .IP \(bu 2.3
451 .\}
452 \fBV\fR
453 (as an SSL server)
454 .RE
455 .sp
456 .RS 4
457 .ie n \{\
458 \h'-04'\(bu\h'+03'\c
459 .\}
460 .el \{\
461 .sp -1
462 .IP \(bu 2.3
463 .\}
464 \fBS\fR
465 (as an email signer)
466 .RE
467 .sp
468 .RS 4
469 .ie n \{\
470 \h'-04'\(bu\h'+03'\c
471 .\}
472 .el \{\
473 .sp -1
474 .IP \(bu 2.3
475 .\}
476 \fBR\fR
477 (as an email recipient)
478 .RE
479 .sp
480 .RS 4
481 .ie n \{\
482 \h'-04'\(bu\h'+03'\c
483 .\}
484 .el \{\
485 .sp -1
486 .IP \(bu 2.3
487 .\}
488 \fBO\fR
489 (as an OCSP status responder)
490 .RE
491 .sp
492 .RS 4
493 .ie n \{\
494 \h'-04'\(bu\h'+03'\c
495 .\}
496 .el \{\
497 .sp -1
498 .IP \(bu 2.3
499 .\}
500 \fBJ\fR
501 (as an object signer)
502 .RE
503 .RE
504 .PP
505 \-v valid\-months
506 .RS 4
507 Set the number of months a new certificate will be valid\&. The validity period begins at the current system time unless an offset is added or subtracted with the
508 \fB\-w\fR
509 option\&. If this argument is not used, the default validity period is three months\&.
510 .RE
511 .PP
512 \-w offset\-months
513 .RS 4
514 Set an offset from the current system time, in months, for the beginning of a certificate\*(Aqs validity period\&. Use when creating the certificate or adding it to a database\&. Express the offset in integers, using a minus sign (\-) to indicate a negative offset\&. If this argument is not used, the validity period begins at the current system time\&. The length of the validity period is set with the \-v argument\&.
515 .RE
516 .PP
517 \-X
518 .RS 4
519 Force the key and certificate database to open in read\-write mode\&. This is used with the
520 \fB\-U\fR
521 and
522 \fB\-L\fR
523 command options\&.
524 .RE
525 .PP
526 \-x
527 .RS 4
528 Use
529 \fBcertutil\fR
530 to generate the signature for a certificate being created or added to a database, rather than obtaining a signature from a separate CA\&.
531 .RE
532 .PP
533 \-y exp
534 .RS 4
535 Set an alternate exponent value to use in generating a new RSA public key for the database, instead of the default value of 65537\&. The available alternate values are 3 and 17\&.
536 .RE
537 .PP
538 \-z noise\-file
539 .RS 4
540 Read a seed value from the specified file to generate a new private and public key pair\&. This argument makes it possible to use hardware\-generated seed values or manually create a value from the keyboard\&. The minimum file size is 20 bytes\&.
541 .RE
542 .PP
543 \-0 SSO_password
544 .RS 4
545 Set a site security officer password on a token\&.
546 .RE
547 .PP
548 \-1 | \-\-keyUsage keyword,keyword
549 .RS 4
550 Set an X\&.509 V3 Certificate Type Extension in the certificate\&. There are several available keywords:
551 .sp
552 .RS 4
553 .ie n \{\
554 \h'-04'\(bu\h'+03'\c
555 .\}
556 .el \{\
557 .sp -1
558 .IP \(bu 2.3
559 .\}
560 digitalSignature
561 .RE
562 .sp
563 .RS 4
564 .ie n \{\
565 \h'-04'\(bu\h'+03'\c
566 .\}
567 .el \{\
568 .sp -1
569 .IP \(bu 2.3
570 .\}
571 nonRepudiation
572 .RE
573 .sp
574 .RS 4
575 .ie n \{\
576 \h'-04'\(bu\h'+03'\c
577 .\}
578 .el \{\
579 .sp -1
580 .IP \(bu 2.3
581 .\}
582 keyEncipherment
583 .RE
584 .sp
585 .RS 4
586 .ie n \{\
587 \h'-04'\(bu\h'+03'\c
588 .\}
589 .el \{\
590 .sp -1
591 .IP \(bu 2.3
592 .\}
593 dataEncipherment
594 .RE
595 .sp
596 .RS 4
597 .ie n \{\
598 \h'-04'\(bu\h'+03'\c
599 .\}
600 .el \{\
601 .sp -1
602 .IP \(bu 2.3
603 .\}
604 keyAgreement
605 .RE
606 .sp
607 .RS 4
608 .ie n \{\
609 \h'-04'\(bu\h'+03'\c
610 .\}
611 .el \{\
612 .sp -1
613 .IP \(bu 2.3
614 .\}
615 certSigning
616 .RE
617 .sp
618 .RS 4
619 .ie n \{\
620 \h'-04'\(bu\h'+03'\c
621 .\}
622 .el \{\
623 .sp -1
624 .IP \(bu 2.3
625 .\}
626 crlSigning
627 .RE
628 .sp
629 .RS 4
630 .ie n \{\
631 \h'-04'\(bu\h'+03'\c
632 .\}
633 .el \{\
634 .sp -1
635 .IP \(bu 2.3
636 .\}
637 critical
638 .RE
639 .RE
640 .PP
641 \-2
642 .RS 4
643 Add a basic constraint extension to a certificate that is being created or added to a database\&. This extension supports the certificate chain verification process\&.
644 \fBcertutil\fR
645 prompts for the certificate constraint extension to select\&.
646 .sp
647 X\&.509 certificate extensions are described in RFC 5280\&.
648 .RE
649 .PP
650 \-3
651 .RS 4
652 Add an authority key ID extension to a certificate that is being created or added to a database\&. This extension supports the identification of a particular certificate, from among multiple certificates associated with one subject name, as the correct issuer of a certificate\&. The Certificate Database Tool will prompt you to select the authority key ID extension\&.
653 .sp
654 X\&.509 certificate extensions are described in RFC 5280\&.
655 .RE
656 .PP
657 \-4
658 .RS 4
659 Add a CRL distribution point extension to a certificate that is being created or added to a database\&. This extension identifies the URL of a certificate\*(Aqs associated certificate revocation list (CRL)\&.
660 \fBcertutil\fR
661 prompts for the URL\&.
662 .sp
663 X\&.509 certificate extensions are described in RFC 5280\&.
664 .RE
665 .PP
666 \-5 | \-\-nsCertType keyword,keyword
667 .RS 4
668 Add an X\&.509 V3 certificate type extension to a certificate that is being created or added to the database\&. There are several available keywords:
669 .sp
670 .RS 4
671 .ie n \{\
672 \h'-04'\(bu\h'+03'\c
673 .\}
674 .el \{\
675 .sp -1
676 .IP \(bu 2.3
677 .\}
678 sslClient
679 .RE
680 .sp
681 .RS 4
682 .ie n \{\
683 \h'-04'\(bu\h'+03'\c
684 .\}
685 .el \{\
686 .sp -1
687 .IP \(bu 2.3
688 .\}
689 sslServer
690 .RE
691 .sp
692 .RS 4
693 .ie n \{\
694 \h'-04'\(bu\h'+03'\c
695 .\}
696 .el \{\
697 .sp -1
698 .IP \(bu 2.3
699 .\}
700 smime
701 .RE
702 .sp
703 .RS 4
704 .ie n \{\
705 \h'-04'\(bu\h'+03'\c
706 .\}
707 .el \{\
708 .sp -1
709 .IP \(bu 2.3
710 .\}
711 objectSigning
712 .RE
713 .sp
714 .RS 4
715 .ie n \{\
716 \h'-04'\(bu\h'+03'\c
717 .\}
718 .el \{\
719 .sp -1
720 .IP \(bu 2.3
721 .\}
722 sslCA
723 .RE
724 .sp
725 .RS 4
726 .ie n \{\
727 \h'-04'\(bu\h'+03'\c
728 .\}
729 .el \{\
730 .sp -1
731 .IP \(bu 2.3
732 .\}
733 smimeCA
734 .RE
735 .sp
736 .RS 4
737 .ie n \{\
738 \h'-04'\(bu\h'+03'\c
739 .\}
740 .el \{\
741 .sp -1
742 .IP \(bu 2.3
743 .\}
744 objectSigningCA
745 .RE
746 .sp
747 .RS 4
748 .ie n \{\
749 \h'-04'\(bu\h'+03'\c
750 .\}
751 .el \{\
752 .sp -1
753 .IP \(bu 2.3
754 .\}
755 critical
756 .RE
757 .sp
758 X\&.509 certificate extensions are described in RFC 5280\&.
759 .RE
760 .PP
761 \-6 | \-\-extKeyUsage keyword,keyword
762 .RS 4
763 Add an extended key usage extension to a certificate that is being created or added to the database\&. Several keywords are available:
764 .sp
765 .RS 4
766 .ie n \{\
767 \h'-04'\(bu\h'+03'\c
768 .\}
769 .el \{\
770 .sp -1
771 .IP \(bu 2.3
772 .\}
773 serverAuth
774 .RE
775 .sp
776 .RS 4
777 .ie n \{\
778 \h'-04'\(bu\h'+03'\c
779 .\}
780 .el \{\
781 .sp -1
782 .IP \(bu 2.3
783 .\}
784 clientAuth
785 .RE
786 .sp
787 .RS 4
788 .ie n \{\
789 \h'-04'\(bu\h'+03'\c
790 .\}
791 .el \{\
792 .sp -1
793 .IP \(bu 2.3
794 .\}
795 codeSigning
796 .RE
797 .sp
798 .RS 4
799 .ie n \{\
800 \h'-04'\(bu\h'+03'\c
801 .\}
802 .el \{\
803 .sp -1
804 .IP \(bu 2.3
805 .\}
806 emailProtection
807 .RE
808 .sp
809 .RS 4
810 .ie n \{\
811 \h'-04'\(bu\h'+03'\c
812 .\}
813 .el \{\
814 .sp -1
815 .IP \(bu 2.3
816 .\}
817 timeStamp
818 .RE
819 .sp
820 .RS 4
821 .ie n \{\
822 \h'-04'\(bu\h'+03'\c
823 .\}
824 .el \{\
825 .sp -1
826 .IP \(bu 2.3
827 .\}
828 ocspResponder
829 .RE
830 .sp
831 .RS 4
832 .ie n \{\
833 \h'-04'\(bu\h'+03'\c
834 .\}
835 .el \{\
836 .sp -1
837 .IP \(bu 2.3
838 .\}
839 stepUp
840 .RE
841 .sp
842 .RS 4
843 .ie n \{\
844 \h'-04'\(bu\h'+03'\c
845 .\}
846 .el \{\
847 .sp -1
848 .IP \(bu 2.3
849 .\}
850 msTrustListSign
851 .RE
852 .sp
853 .RS 4
854 .ie n \{\
855 \h'-04'\(bu\h'+03'\c
856 .\}
857 .el \{\
858 .sp -1
859 .IP \(bu 2.3
860 .\}
861 critical
862 .RE
863 .sp
864 X\&.509 certificate extensions are described in RFC 5280\&.
865 .RE
866 .PP
867 \-7 emailAddrs
868 .RS 4
869 Add a comma\-separated list of email addresses to the subject alternative name extension of a certificate or certificate request that is being created or added to the database\&. Subject alternative name extensions are described in Section 4\&.2\&.1\&.7 of RFC 3280\&.
870 .RE
871 .PP
872 \-8 dns\-names
873 .RS 4
874 Add a comma\-separated list of DNS names to the subject alternative name extension of a certificate or certificate request that is being created or added to the database\&. Subject alternative name extensions are described in Section 4\&.2\&.1\&.7 of RFC 3280\&.
875 .RE
876 .PP
877 \-\-extAIA
878 .RS 4
879 Add the Authority Information Access extension to the certificate\&. X\&.509 certificate extensions are described in RFC 5280\&.
880 .RE
881 .PP
882 \-\-extSIA
883 .RS 4
884 Add the Subject Information Access extension to the certificate\&. X\&.509 certificate extensions are described in RFC 5280\&.
885 .RE
886 .PP
887 \-\-extCP
888 .RS 4
889 Add the Certificate Policies extension to the certificate\&. X\&.509 certificate extensions are described in RFC 5280\&.
890 .RE
891 .PP
892 \-\-extPM
893 .RS 4
894 Add the Policy Mappings extension to the certificate\&. X\&.509 certificate extensions are described in RFC 5280\&.
895 .RE
896 .PP
897 \-\-extPC
898 .RS 4
899 Add the Policy Constraints extension to the certificate\&. X\&.509 certificate extensions are described in RFC 5280\&.
900 .RE
901 .PP
902 \-\-extIA
903 .RS 4
904 Add the Inhibit Any Policy Access extension to the certificate\&. X\&.509 certificate extensions are described in RFC 5280\&.
905 .RE
906 .PP
907 \-\-extSKID
908 .RS 4
909 Add the Subject Key ID extension to the certificate\&. X\&.509 certificate extensions are described in RFC 5280\&.
910 .RE
911 .PP
912 \-\-extNC
913 .RS 4
914 Add a Name Constraint extension to the certificate\&. X\&.509 certificate extensions are described in RFC 5280\&.
915 .RE
916 .PP
917 \-\-empty\-password
918 .RS 4
919 Use empty password when creating new certificate database with \-N\&.
920 .RE
921 .PP
922 \-\-keyAttrFlags attrflags
923 .RS 4
924 PKCS #11 key Attributes\&. Comma separated list of key attribute flags, selected from the following list of choices: {token | session} {public | private} {sensitive | insensitive} {modifiable | unmodifiable} {extractable | unextractable}
925 .RE
926 .PP
927 \-\-keyOpFlagsOn opflags, \-\-keyOpFlagsOff opflags
928 .RS 4
929 PKCS #11 key Operation Flags\&. Comma separated list of one or more of the following: {token | session} {public | private} {sensitive | insensitive} {modifiable | unmodifiable} {extractable | unextractable}
930 .RE
931 .PP
932 \-\-source\-dir certdir
933 .RS 4
934 Identify the certificate database directory to upgrade\&.
935 .RE
936 .PP
937 \-\-source\-prefix certdir
938 .RS 4
939 Give the prefix of the certificate and key databases to upgrade\&.
940 .RE
941 .PP
942 \-\-upgrade\-id uniqueID
943 .RS 4
944 Give the unique ID of the database to upgrade\&.
945 .RE
946 .PP
947 \-\-upgrade\-token\-name name
948 .RS 4
949 Set the name of the token to use while it is being upgraded\&.
950 .RE
951 .PP
952 \-@ pwfile
953 .RS 4
954 Give the name of a password file to use for the database being upgraded\&.
955 .RE
956 .SH "USAGE AND EXAMPLES"
957 .PP
958 Most of the command options in the examples listed here have more arguments available\&. The arguments included in these examples are the most common ones or are used to illustrate a specific scenario\&. Use the
959 \fB\-H\fR
960 option to show the complete list of arguments for each command option\&.
961 .PP
962 \fBCreating New Security Databases\fR
963 .PP
964 Certificates, keys, and security modules related to managing certificates are stored in three related databases:
965 .sp
966 .RS 4
967 .ie n \{\
968 \h'-04'\(bu\h'+03'\c
969 .\}
970 .el \{\
971 .sp -1
972 .IP \(bu 2.3
973 .\}
974 cert8\&.db or cert9\&.db
975 .RE
976 .sp
977 .RS 4
978 .ie n \{\
979 \h'-04'\(bu\h'+03'\c
980 .\}
981 .el \{\
982 .sp -1
983 .IP \(bu 2.3
984 .\}
985 key3\&.db or key4\&.db
986 .RE
987 .sp
988 .RS 4
989 .ie n \{\
990 \h'-04'\(bu\h'+03'\c
991 .\}
992 .el \{\
993 .sp -1
994 .IP \(bu 2.3
995 .\}
996 secmod\&.db or pkcs11\&.txt
997 .RE
998 .PP
999 These databases must be created before certificates or keys can be generated\&.
1000 .sp
1001 .if n \{\
1002 .RS 4
1003 .\}
1004 .nf
1005 certutil \-N \-d [sql:]directory
1006 .fi
1007 .if n \{\
1008 .RE
1009 .\}
1010 .PP
1011 \fBCreating a Certificate Request\fR
1012 .PP
1013 A certificate request contains most or all of the information that is used to generate the final certificate\&. This request is submitted separately to a certificate authority and is then approved by some mechanism (automatically or by human review)\&. Once the request is approved, then the certificate is generated\&.
1014 .sp
1015 .if n \{\
1016 .RS 4
1017 .\}
1018 .nf
1019 $ certutil \-R \-k key\-type\-or\-id [\-q pqgfile|curve\-name] \-g key\-size \-s subject [\-h tokenname] \-d [sql:]directory [\-p phone] [\-o output\-file] [\-a]
1020 .fi
1021 .if n \{\
1022 .RE
1023 .\}
1024 .PP
1025 The
1026 \fB\-R\fR
1027 command options requires four arguments:
1028 .sp
1029 .RS 4
1030 .ie n \{\
1031 \h'-04'\(bu\h'+03'\c
1032 .\}
1033 .el \{\
1034 .sp -1
1035 .IP \(bu 2.3
1036 .\}
1037 \fB\-k\fR
1038 to specify either the key type to generate or, when renewing a certificate, the existing key pair to use
1039 .RE
1040 .sp
1041 .RS 4
1042 .ie n \{\
1043 \h'-04'\(bu\h'+03'\c
1044 .\}
1045 .el \{\
1046 .sp -1
1047 .IP \(bu 2.3
1048 .\}
1049 \fB\-g\fR
1050 to set the keysize of the key to generate
1051 .RE
1052 .sp
1053 .RS 4
1054 .ie n \{\
1055 \h'-04'\(bu\h'+03'\c
1056 .\}
1057 .el \{\
1058 .sp -1
1059 .IP \(bu 2.3
1060 .\}
1061 \fB\-s\fR
1062 to set the subject name of the certificate
1063 .RE
1064 .sp
1065 .RS 4
1066 .ie n \{\
1067 \h'-04'\(bu\h'+03'\c
1068 .\}
1069 .el \{\
1070 .sp -1
1071 .IP \(bu 2.3
1072 .\}
1073 \fB\-d\fR
1074 to give the security database directory
1075 .RE
1076 .PP
1077 The new certificate request can be output in ASCII format (\fB\-a\fR) or can be written to a specified file (\fB\-o\fR)\&.
1078 .PP
1079 For example:
1080 .sp
1081 .if n \{\
1082 .RS 4
1083 .\}
1084 .nf
1085 $ certutil \-R \-k rsa \-g 1024 \-s "CN=John Smith,O=Example Corp,L=Mountain View,ST=California,C=US" \-d sql:$HOME/nssdb \-p 650\-555\-0123 \-a \-o cert\&.cer
1087 Generating key\&. This may take a few moments\&.\&.\&.
1089 .fi
1090 .if n \{\
1091 .RE
1092 .\}
1093 .PP
1094 \fBCreating a Certificate\fR
1095 .PP
1096 A valid certificate must be issued by a trusted CA\&. This can be done by specifying a CA certificate (\fB\-c\fR) that is stored in the certificate database\&. If a CA key pair is not available, you can create a self\-signed certificate using the
1097 \fB\-x\fR
1098 argument with the
1099 \fB\-S\fR
1100 command option\&.
1101 .sp
1102 .if n \{\
1103 .RS 4
1104 .\}
1105 .nf
1106 $ certutil \-S \-k rsa|dsa|ec \-n certname \-s subject [\-c issuer |\-x] \-t trustargs \-d [sql:]directory [\-m serial\-number] [\-v valid\-months] [\-w offset\-months] [\-p phone] [\-1] [\-2] [\-3] [\-4] [\-5 keyword] [\-6 keyword] [\-7 emailAddress] [\-8 dns\-names] [\-\-extAIA] [\-\-extSIA] [\-\-extCP] [\-\-extPM] [\-\-extPC] [\-\-extIA] [\-\-extSKID]
1107 .fi
1108 .if n \{\
1109 .RE
1110 .\}
1111 .PP
1112 The series of numbers and
1113 \fB\-\-ext*\fR
1114 options set certificate extensions that can be added to the certificate when it is generated by the CA\&. Interactive prompts will result\&.
1115 .PP
1116 For example, this creates a self\-signed certificate:
1117 .sp
1118 .if n \{\
1119 .RS 4
1120 .\}
1121 .nf
1122 $ certutil \-S \-s "CN=Example CA" \-n my\-ca\-cert \-x \-t "C,C,C" \-1 \-2 \-5 \-m 3650
1123 .fi
1124 .if n \{\
1125 .RE
1126 .\}
1127 .PP
1128 The interative prompts for key usage and whether any extensions are critical and responses have been ommitted for brevity\&.
1129 .PP
1130 From there, new certificates can reference the self\-signed certificate:
1131 .sp
1132 .if n \{\
1133 .RS 4
1134 .\}
1135 .nf
1136 $ certutil \-S \-s "CN=My Server Cert" \-n my\-server\-cert \-c "my\-ca\-cert" \-t "u,u,u" \-1 \-5 \-6 \-8 \-m 730
1137 .fi
1138 .if n \{\
1139 .RE
1140 .\}
1141 .PP
1142 \fBGenerating a Certificate from a Certificate Request\fR
1143 .PP
1144 When a certificate request is created, a certificate can be generated by using the request and then referencing a certificate authority signing certificate (the
1145 \fIissuer\fR
1146 specified in the
1147 \fB\-c\fR
1148 argument)\&. The issuing certificate must be in the certificate database in the specified directory\&.
1149 .sp
1150 .if n \{\
1151 .RS 4
1152 .\}
1153 .nf
1154 certutil \-C \-c issuer \-i cert\-request\-file \-o output\-file [\-m serial\-number] [\-v valid\-months] [\-w offset\-months] \-d [sql:]directory [\-1] [\-2] [\-3] [\-4] [\-5 keyword] [\-6 keyword] [\-7 emailAddress] [\-8 dns\-names]
1155 .fi
1156 .if n \{\
1157 .RE
1158 .\}
1159 .PP
1160 For example:
1161 .sp
1162 .if n \{\
1163 .RS 4
1164 .\}
1165 .nf
1166 $ certutil \-C \-c "my\-ca\-cert" \-i /home/certs/cert\&.req \-o cert\&.cer \-m 010 \-v 12 \-w 1 \-d sql:$HOME/nssdb \-1 nonRepudiation,dataEncipherment \-5 sslClient \-6 clientAuth \-7 jsmith@example\&.com
1167 .fi
1168 .if n \{\
1169 .RE
1170 .\}
1171 .PP
1172 \fBListing Certificates\fR
1173 .PP
1174 The
1175 \fB\-L\fR
1176 command option lists all of the certificates listed in the certificate database\&. The path to the directory (\fB\-d\fR) is required\&.
1177 .sp
1178 .if n \{\
1179 .RS 4
1180 .\}
1181 .nf
1182 $ certutil \-L \-d sql:/home/my/sharednssdb
1184 Certificate Nickname Trust Attributes
1185 SSL,S/MIME,JAR/XPI
1187 CA Administrator of Instance pki\-ca1\*(Aqs Example Domain ID u,u,u
1188 TPS Administrator\*(Aqs Example Domain ID u,u,u
1189 Google Internet Authority ,,
1190 Certificate Authority \- Example Domain CT,C,C
1191 .fi
1192 .if n \{\
1193 .RE
1194 .\}
1195 .PP
1196 Using additional arguments with
1197 \fB\-L\fR
1198 can return and print the information for a single, specific certificate\&. For example, the
1199 \fB\-n\fR
1200 argument passes the certificate name, while the
1201 \fB\-a\fR
1202 argument prints the certificate in ASCII format:
1203 .sp
1204 .if n \{\
1205 .RS 4
1206 .\}
1207 .nf
1208 $ certutil \-L \-d sql:$HOME/nssdb \-a \-n my\-ca\-cert
1209 \-\-\-\-\-BEGIN CERTIFICATE\-\-\-\-\-
1210 MIIB1DCCAT2gAwIBAgICDkIwDQYJKoZIhvcNAQEFBQAwFTETMBEGA1UEAxMKRXhh
1211 bXBsZSBDQTAeFw0xMzAzMTMxOTEwMjlaFw0xMzA2MTMxOTEwMjlaMBUxEzARBgNV
1212 BAMTCkV4YW1wbGUgQ0EwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAJ4Kzqvz
1213 JyBVgFqDXRYSyTBNw1DrxUU/3GvWA/ngjAwHEv0Cul/6sO/gsCvnABHiH6unns6x
1214 XRzPORlC2WY3gkk7vmlsLvYpyecNazAi/NAwVnU/66HOsaoVFWE+gBQo99UrN2yk
1215 0BiK/GMFlLm5dXQROgA9ZKKyFdI0LIXtf6SbAgMBAAGjMzAxMBEGCWCGSAGG+EIB
1216 AQQEAwIHADAMBgNVHRMEBTADAQH/MA4GA1UdDwEB/wQEAwICBDANBgkqhkiG9w0B
1217 AQUFAAOBgQA6chkzkACN281d1jKMrc+RHG2UMaQyxiteaLVZO+Ro1nnRUvseDf09
1218 XKYFwPMJjWCihVku6bw/ihZfuMHhxK22Nue6inNQ6eDu7WmrqL8z3iUrQwxs+WiF
1219 ob2rb8XRVVJkzXdXxlk4uo3UtNvw8sAz7sWD71qxKaIHU5q49zijfg==
1220 \-\-\-\-\-END CERTIFICATE\-\-\-\-\-
1221 .fi
1222 .if n \{\
1223 .RE
1224 .\}
1225 .PP
1226 For a human\-readable display
1227 .sp
1228 .if n \{\
1229 .RS 4
1230 .\}
1231 .nf
1232 $ certutil \-L \-d sql:$HOME/nssdb \-n my\-ca\-cert
1233 Certificate:
1234 Data:
1235 Version: 3 (0x2)
1236 Serial Number: 3650 (0xe42)
1237 Signature Algorithm: PKCS #1 SHA\-1 With RSA Encryption
1238 Issuer: "CN=Example CA"
1239 Validity:
1240 Not Before: Wed Mar 13 19:10:29 2013
1241 Not After : Thu Jun 13 19:10:29 2013
1242 Subject: "CN=Example CA"
1243 Subject Public Key Info:
1244 Public Key Algorithm: PKCS #1 RSA Encryption
1245 RSA Public Key:
1246 Modulus:
1247 9e:0a:ce:ab:f3:27:20:55:80:5a:83:5d:16:12:c9:30:
1248 4d:c3:50:eb:c5:45:3f:dc:6b:d6:03:f9:e0:8c:0c:07:
1249 12:fd:02:ba:5f:fa:b0:ef:e0:b0:2b:e7:00:11:e2:1f:
1250 ab:a7:9e:ce:b1:5d:1c:cf:39:19:42:d9:66:37:82:49:
1251 3b:be:69:6c:2e:f6:29:c9:e7:0d:6b:30:22:fc:d0:30:
1252 56:75:3f:eb:a1:ce:b1:aa:15:15:61:3e:80:14:28:f7:
1253 d5:2b:37:6c:a4:d0:18:8a:fc:63:05:94:b9:b9:75:74:
1254 11:3a:00:3d:64:a2:b2:15:d2:34:2c:85:ed:7f:a4:9b
1255 Exponent: 65537 (0x10001)
1256 Signed Extensions:
1257 Name: Certificate Type
1258 Data: none
1260 Name: Certificate Basic Constraints
1261 Data: Is a CA with no maximum path length\&.
1263 Name: Certificate Key Usage
1264 Critical: True
1265 Usages: Certificate Signing
1267 Signature Algorithm: PKCS #1 SHA\-1 With RSA Encryption
1268 Signature:
1269 3a:72:19:33:90:00:8d:db:cd:5d:d6:32:8c:ad:cf:91:
1270 1c:6d:94:31:a4:32:c6:2b:5e:68:b5:59:3b:e4:68:d6:
1271 79:d1:52:fb:1e:0d:fd:3d:5c:a6:05:c0:f3:09:8d:60:
1272 a2:85:59:2e:e9:bc:3f:8a:16:5f:b8:c1:e1:c4:ad:b6:
1273 36:e7:ba:8a:73:50:e9:e0:ee:ed:69:ab:a8:bf:33:de:
1274 25:2b:43:0c:6c:f9:68:85:a1:bd:ab:6f:c5:d1:55:52:
1275 64:cd:77:57:c6:59:38:ba:8d:d4:b4:db:f0:f2:c0:33:
1276 ee:c5:83:ef:5a:b1:29:a2:07:53:9a:b8:f7:38:a3:7e
1277 Fingerprint (MD5):
1278 86:D8:A5:8B:8A:26:BE:9E:17:A8:7B:66:10:6B:27:80
1279 Fingerprint (SHA1):
1280 48:78:09:EF:C5:D4:0C:BD:D2:64:45:59:EB:03:13:15:F7:A9:D6:F7
1282 Certificate Trust Flags:
1283 SSL Flags:
1284 Valid CA
1285 Trusted CA
1286 User
1287 Email Flags:
1288 Valid CA
1289 Trusted CA
1290 User
1291 Object Signing Flags:
1292 Valid CA
1293 Trusted CA
1294 User
1296 .fi
1297 .if n \{\
1298 .RE
1299 .\}
1300 .PP
1301 \fBListing Keys\fR
1302 .PP
1303 Keys are the original material used to encrypt certificate data\&. The keys generated for certificates are stored separately, in the key database\&.
1304 .PP
1305 To list all keys in the database, use the
1306 \fB\-K\fR
1307 command option and the (required)
1308 \fB\-d\fR
1309 argument to give the path to the directory\&.
1310 .sp
1311 .if n \{\
1312 .RS 4
1313 .\}
1314 .nf
1315 $ certutil \-K \-d sql:$HOME/nssdb
1316 certutil: Checking token "NSS Certificate DB" in slot "NSS User Private Key and Certificate Services "
1317 < 0> rsa 455a6673bde9375c2887ec8bf8016b3f9f35861d Thawte Freemail Member\*(Aqs Thawte Consulting (Pty) Ltd\&. ID
1318 < 1> rsa 40defeeb522ade11090eacebaaf1196a172127df Example Domain Administrator Cert
1319 < 2> rsa 1d0b06f44f6c03842f7d4f4a1dc78b3bcd1b85a5 John Smith user cert
1320 .fi
1321 .if n \{\
1322 .RE
1323 .\}
1324 .PP
1325 There are ways to narrow the keys listed in the search results:
1326 .sp
1327 .RS 4
1328 .ie n \{\
1329 \h'-04'\(bu\h'+03'\c
1330 .\}
1331 .el \{\
1332 .sp -1
1333 .IP \(bu 2.3
1334 .\}
1335 To return a specific key, use the
1336 \fB\-n\fR\fIname\fR
1337 argument with the name of the key\&.
1338 .RE
1339 .sp
1340 .RS 4
1341 .ie n \{\
1342 \h'-04'\(bu\h'+03'\c
1343 .\}
1344 .el \{\
1345 .sp -1
1346 .IP \(bu 2.3
1347 .\}
1348 If there are multiple security devices loaded, then the
1349 \fB\-h\fR\fItokenname\fR
1350 argument can search a specific token or all tokens\&.
1351 .RE
1352 .sp
1353 .RS 4
1354 .ie n \{\
1355 \h'-04'\(bu\h'+03'\c
1356 .\}
1357 .el \{\
1358 .sp -1
1359 .IP \(bu 2.3
1360 .\}
1361 If there are multiple key types available, then the
1362 \fB\-k\fR\fIkey\-type\fR
1363 argument can search a specific type of key, like RSA, DSA, or ECC\&.
1364 .RE
1365 .PP
1366 \fBListing Security Modules\fR
1367 .PP
1368 The devices that can be used to store certificates \-\- both internal databases and external devices like smart cards \-\- are recognized and used by loading security modules\&. The
1369 \fB\-U\fR
1370 command option lists all of the security modules listed in the
1371 secmod\&.db
1372 database\&. The path to the directory (\fB\-d\fR) is required\&.
1373 .sp
1374 .if n \{\
1375 .RS 4
1376 .\}
1377 .nf
1378 $ certutil \-U \-d sql:/home/my/sharednssdb
1380 slot: NSS User Private Key and Certificate Services
1381 token: NSS Certificate DB
1383 slot: NSS Internal Cryptographic Services
1384 token: NSS Generic Crypto Services
1385 .fi
1386 .if n \{\
1387 .RE
1388 .\}
1389 .PP
1390 \fBAdding Certificates to the Database\fR
1391 .PP
1392 Existing certificates or certificate requests can be added manually to the certificate database, even if they were generated elsewhere\&. This uses the
1393 \fB\-A\fR
1394 command option\&.
1395 .sp
1396 .if n \{\
1397 .RS 4
1398 .\}
1399 .nf
1400 certutil \-A \-n certname \-t trustargs \-d [sql:]directory [\-a] [\-i input\-file]
1401 .fi
1402 .if n \{\
1403 .RE
1404 .\}
1405 .PP
1406 For example:
1407 .sp
1408 .if n \{\
1409 .RS 4
1410 .\}
1411 .nf
1412 $ certutil \-A \-n "CN=My SSL Certificate" \-t "u,u,u" \-d sql:/home/my/sharednssdb \-i /home/example\-certs/cert\&.cer
1413 .fi
1414 .if n \{\
1415 .RE
1416 .\}
1417 .PP
1418 A related command option,
1419 \fB\-E\fR, is used specifically to add email certificates to the certificate database\&. The
1420 \fB\-E\fR
1421 command has the same arguments as the
1422 \fB\-A\fR
1423 command\&. The trust arguments for certificates have the format
1424 \fISSL,S/MIME,Code\-signing\fR, so the middle trust settings relate most to email certificates (though the others can be set)\&. For example:
1425 .sp
1426 .if n \{\
1427 .RS 4
1428 .\}
1429 .nf
1430 $ certutil \-E \-n "CN=John Smith Email Cert" \-t ",Pu," \-d sql:/home/my/sharednssdb \-i /home/example\-certs/email\&.cer
1431 .fi
1432 .if n \{\
1433 .RE
1434 .\}
1435 .PP
1436 \fBDeleting Certificates to the Database\fR
1437 .PP
1438 Certificates can be deleted from a database using the
1439 \fB\-D\fR
1440 option\&. The only required options are to give the security database directory and to identify the certificate nickname\&.
1441 .sp
1442 .if n \{\
1443 .RS 4
1444 .\}
1445 .nf
1446 certutil \-D \-d [sql:]directory \-n "nickname"
1447 .fi
1448 .if n \{\
1449 .RE
1450 .\}
1451 .PP
1452 For example:
1453 .sp
1454 .if n \{\
1455 .RS 4
1456 .\}
1457 .nf
1458 $ certutil \-D \-d sql:/home/my/sharednssdb \-n "my\-ssl\-cert"
1459 .fi
1460 .if n \{\
1461 .RE
1462 .\}
1463 .PP
1464 \fBValidating Certificates\fR
1465 .PP
1466 A certificate contains an expiration date in itself, and expired certificates are easily rejected\&. However, certificates can also be revoked before they hit their expiration date\&. Checking whether a certificate has been revoked requires validating the certificate\&. Validation can also be used to ensure that the certificate is only used for the purposes it was initially issued for\&. Validation is carried out by the
1467 \fB\-V\fR
1468 command option\&.
1469 .sp
1470 .if n \{\
1471 .RS 4
1472 .\}
1473 .nf
1474 certutil \-V \-n certificate\-name [\-b time] [\-e] [\-u cert\-usage] \-d [sql:]directory
1475 .fi
1476 .if n \{\
1477 .RE
1478 .\}
1479 .PP
1480 For example, to validate an email certificate:
1481 .sp
1482 .if n \{\
1483 .RS 4
1484 .\}
1485 .nf
1486 $ certutil \-V \-n "John Smith\*(Aqs Email Cert" \-e \-u S,R \-d sql:/home/my/sharednssdb
1487 .fi
1488 .if n \{\
1489 .RE
1490 .\}
1491 .PP
1492 \fBModifying Certificate Trust Settings\fR
1493 .PP
1494 The trust settings (which relate to the operations that a certificate is allowed to be used for) can be changed after a certificate is created or added to the database\&. This is especially useful for CA certificates, but it can be performed for any type of certificate\&.
1495 .sp
1496 .if n \{\
1497 .RS 4
1498 .\}
1499 .nf
1500 certutil \-M \-n certificate\-name \-t trust\-args \-d [sql:]directory
1501 .fi
1502 .if n \{\
1503 .RE
1504 .\}
1505 .PP
1506 For example:
1507 .sp
1508 .if n \{\
1509 .RS 4
1510 .\}
1511 .nf
1512 $ certutil \-M \-n "My CA Certificate" \-d sql:/home/my/sharednssdb \-t "CTu,CTu,CTu"
1513 .fi
1514 .if n \{\
1515 .RE
1516 .\}
1517 .PP
1518 \fBPrinting the Certificate Chain\fR
1519 .PP
1520 Certificates can be issued in
1521 \fIchains\fR
1522 because every certificate authority itself has a certificate; when a CA issues a certificate, it essentially stamps that certificate with its own fingerprint\&. The
1523 \fB\-O\fR
1524 prints the full chain of a certificate, going from the initial CA (the root CA) through ever intermediary CA to the actual certificate\&. For example, for an email certificate with two CAs in the chain:
1525 .sp
1526 .if n \{\
1527 .RS 4
1528 .\}
1529 .nf
1530 $ certutil \-d sql:/home/my/sharednssdb \-O \-n "jsmith@example\&.com"
1531 "Builtin Object Token:Thawte Personal Freemail CA" [E=personal\-freemail@thawte\&.com,CN=Thawte Personal Freemail CA,OU=Certification Services Division,O=Thawte Consulting,L=Cape Town,ST=Western Cape,C=ZA]
1533 "Thawte Personal Freemail Issuing CA \- Thawte Consulting" [CN=Thawte Personal Freemail Issuing CA,O=Thawte Consulting (Pty) Ltd\&.,C=ZA]
1535 "(null)" [E=jsmith@example\&.com,CN=Thawte Freemail Member]
1536 .fi
1537 .if n \{\
1538 .RE
1539 .\}
1540 .PP
1541 \fBResetting a Token\fR
1542 .PP
1543 The device which stores certificates \-\- both external hardware devices and internal software databases \-\- can be blanked and reused\&. This operation is performed on the device which stores the data, not directly on the security databases, so the location must be referenced through the token name (\fB\-h\fR) as well as any directory path\&. If there is no external token used, the default value is internal\&.
1544 .sp
1545 .if n \{\
1546 .RS 4
1547 .\}
1548 .nf
1549 certutil \-T \-d [sql:]directory \-h token\-name \-0 security\-officer\-password
1550 .fi
1551 .if n \{\
1552 .RE
1553 .\}
1554 .PP
1555 Many networks have dedicated personnel who handle changes to security tokens (the security officer)\&. This person must supply the password to access the specified token\&. For example:
1556 .sp
1557 .if n \{\
1558 .RS 4
1559 .\}
1560 .nf
1561 $ certutil \-T \-d sql:/home/my/sharednssdb \-h nethsm \-0 secret
1562 .fi
1563 .if n \{\
1564 .RE
1565 .\}
1566 .PP
1567 \fBUpgrading or Merging the Security Databases\fR
1568 .PP
1569 Many networks or applications may be using older BerkeleyDB versions of the certificate database (cert8\&.db)\&. Databases can be upgraded to the new SQLite version of the database (cert9\&.db) using the
1570 \fB\-\-upgrade\-merge\fR
1571 command option or existing databases can be merged with the new
1572 cert9\&.db
1573 databases using the
1574 \fB\-\-\-merge\fR
1575 command\&.
1576 .PP
1577 The
1578 \fB\-\-upgrade\-merge\fR
1579 command must give information about the original database and then use the standard arguments (like
1580 \fB\-d\fR) to give the information about the new databases\&. The command also requires information that the tool uses for the process to upgrade and write over the original database\&.
1581 .sp
1582 .if n \{\
1583 .RS 4
1584 .\}
1585 .nf
1586 certutil \-\-upgrade\-merge \-d [sql:]directory [\-P dbprefix] \-\-source\-dir directory \-\-source\-prefix dbprefix \-\-upgrade\-id id \-\-upgrade\-token\-name name [\-@ password\-file]
1587 .fi
1588 .if n \{\
1589 .RE
1590 .\}
1591 .PP
1592 For example:
1593 .sp
1594 .if n \{\
1595 .RS 4
1596 .\}
1597 .nf
1598 $ certutil \-\-upgrade\-merge \-d sql:/home/my/sharednssdb \-\-source\-dir /opt/my\-app/alias/ \-\-source\-prefix serverapp\- \-\-upgrade\-id 1 \-\-upgrade\-token\-name internal
1599 .fi
1600 .if n \{\
1601 .RE
1602 .\}
1603 .PP
1604 The
1605 \fB\-\-merge\fR
1606 command only requires information about the location of the original database; since it doesn\*(Aqt change the format of the database, it can write over information without performing interim step\&.
1607 .sp
1608 .if n \{\
1609 .RS 4
1610 .\}
1611 .nf
1612 certutil \-\-merge \-d [sql:]directory [\-P dbprefix] \-\-source\-dir directory \-\-source\-prefix dbprefix [\-@ password\-file]
1613 .fi
1614 .if n \{\
1615 .RE
1616 .\}
1617 .PP
1618 For example:
1619 .sp
1620 .if n \{\
1621 .RS 4
1622 .\}
1623 .nf
1624 $ certutil \-\-merge \-d sql:/home/my/sharednssdb \-\-source\-dir /opt/my\-app/alias/ \-\-source\-prefix serverapp\-
1625 .fi
1626 .if n \{\
1627 .RE
1628 .\}
1629 .PP
1630 \fBRunning certutil Commands from a Batch File\fR
1631 .PP
1632 A series of commands can be run sequentially from a text file with the
1633 \fB\-B\fR
1634 command option\&. The only argument for this specifies the input file\&.
1635 .sp
1636 .if n \{\
1637 .RS 4
1638 .\}
1639 .nf
1640 $ certutil \-B \-i /path/to/batch\-file
1641 .fi
1642 .if n \{\
1643 .RE
1644 .\}
1645 .SH "NSS DATABASE TYPES"
1646 .PP
1647 NSS originally used BerkeleyDB databases to store security information\&. The last versions of these
1648 \fIlegacy\fR
1649 databases are:
1650 .sp
1651 .RS 4
1652 .ie n \{\
1653 \h'-04'\(bu\h'+03'\c
1654 .\}
1655 .el \{\
1656 .sp -1
1657 .IP \(bu 2.3
1658 .\}
1659 cert8\&.db for certificates
1660 .RE
1661 .sp
1662 .RS 4
1663 .ie n \{\
1664 \h'-04'\(bu\h'+03'\c
1665 .\}
1666 .el \{\
1667 .sp -1
1668 .IP \(bu 2.3
1669 .\}
1670 key3\&.db for keys
1671 .RE
1672 .sp
1673 .RS 4
1674 .ie n \{\
1675 \h'-04'\(bu\h'+03'\c
1676 .\}
1677 .el \{\
1678 .sp -1
1679 .IP \(bu 2.3
1680 .\}
1681 secmod\&.db for PKCS #11 module information
1682 .RE
1683 .PP
1684 BerkeleyDB has performance limitations, though, which prevent it from being easily used by multiple applications simultaneously\&. NSS has some flexibility that allows applications to use their own, independent database engine while keeping a shared database and working around the access issues\&. Still, NSS requires more flexibility to provide a truly shared security database\&.
1685 .PP
1686 In 2009, NSS introduced a new set of databases that are SQLite databases rather than BerkeleyDB\&. These new databases provide more accessibility and performance:
1687 .sp
1688 .RS 4
1689 .ie n \{\
1690 \h'-04'\(bu\h'+03'\c
1691 .\}
1692 .el \{\
1693 .sp -1
1694 .IP \(bu 2.3
1695 .\}
1696 cert9\&.db for certificates
1697 .RE
1698 .sp
1699 .RS 4
1700 .ie n \{\
1701 \h'-04'\(bu\h'+03'\c
1702 .\}
1703 .el \{\
1704 .sp -1
1705 .IP \(bu 2.3
1706 .\}
1707 key4\&.db for keys
1708 .RE
1709 .sp
1710 .RS 4
1711 .ie n \{\
1712 \h'-04'\(bu\h'+03'\c
1713 .\}
1714 .el \{\
1715 .sp -1
1716 .IP \(bu 2.3
1717 .\}
1718 pkcs11\&.txt, a listing of all of the PKCS #11 modules, contained in a new subdirectory in the security databases directory
1719 .RE
1720 .PP
1721 Because the SQLite databases are designed to be shared, these are the
1722 \fIshared\fR
1723 database type\&. The shared database type is preferred; the legacy format is included for backward compatibility\&.
1724 .PP
1725 By default, the tools (\fBcertutil\fR,
1726 \fBpk12util\fR,
1727 \fBmodutil\fR) assume that the given security databases follow the more common legacy type\&. Using the SQLite databases must be manually specified by using the
1728 \fBsql:\fR
1729 prefix with the given security directory\&. For example:
1730 .sp
1731 .if n \{\
1732 .RS 4
1733 .\}
1734 .nf
1735 $ certutil \-L \-d sql:/home/my/sharednssdb
1736 .fi
1737 .if n \{\
1738 .RE
1739 .\}
1740 .PP
1741 To set the shared database type as the default type for the tools, set the
1742 \fBNSS_DEFAULT_DB_TYPE\fR
1743 environment variable to
1744 \fBsql\fR:
1745 .sp
1746 .if n \{\
1747 .RS 4
1748 .\}
1749 .nf
1750 export NSS_DEFAULT_DB_TYPE="sql"
1751 .fi
1752 .if n \{\
1753 .RE
1754 .\}
1755 .PP
1756 This line can be set added to the
1757 ~/\&.bashrc
1758 file to make the change permanent\&.
1759 .PP
1760 Most applications do not use the shared database by default, but they can be configured to use them\&. For example, this how\-to article covers how to configure Firefox and Thunderbird to use the new shared NSS databases:
1761 .sp
1762 .RS 4
1763 .ie n \{\
1764 \h'-04'\(bu\h'+03'\c
1765 .\}
1766 .el \{\
1767 .sp -1
1768 .IP \(bu 2.3
1769 .\}
1770 https://wiki\&.mozilla\&.org/NSS_Shared_DB_Howto
1771 .RE
1772 .PP
1773 For an engineering draft on the changes in the shared NSS databases, see the NSS project wiki:
1774 .sp
1775 .RS 4
1776 .ie n \{\
1777 \h'-04'\(bu\h'+03'\c
1778 .\}
1779 .el \{\
1780 .sp -1
1781 .IP \(bu 2.3
1782 .\}
1783 https://wiki\&.mozilla\&.org/NSS_Shared_DB
1784 .RE
1785 .SH "SEE ALSO"
1786 .PP
1787 pk12util (1)
1788 .PP
1789 modutil (1)
1790 .PP
1791 \fBcertutil\fR
1792 has arguments or operations that use features defined in several IETF RFCs\&.
1793 .sp
1794 .RS 4
1795 .ie n \{\
1796 \h'-04'\(bu\h'+03'\c
1797 .\}
1798 .el \{\
1799 .sp -1
1800 .IP \(bu 2.3
1801 .\}
1802 http://tools\&.ietf\&.org/html/rfc5280
1803 .RE
1804 .sp
1805 .RS 4
1806 .ie n \{\
1807 \h'-04'\(bu\h'+03'\c
1808 .\}
1809 .el \{\
1810 .sp -1
1811 .IP \(bu 2.3
1812 .\}
1813 http://tools\&.ietf\&.org/html/rfc1113
1814 .RE
1815 .sp
1816 .RS 4
1817 .ie n \{\
1818 \h'-04'\(bu\h'+03'\c
1819 .\}
1820 .el \{\
1821 .sp -1
1822 .IP \(bu 2.3
1823 .\}
1824 http://tools\&.ietf\&.org/html/rfc1485
1825 .RE
1826 .PP
1827 The NSS wiki has information on the new database design and how to configure applications to use it\&.
1828 .sp
1829 .RS 4
1830 .ie n \{\
1831 \h'-04'\(bu\h'+03'\c
1832 .\}
1833 .el \{\
1834 .sp -1
1835 .IP \(bu 2.3
1836 .\}
1837 https://wiki\&.mozilla\&.org/NSS_Shared_DB_Howto
1838 .RE
1839 .sp
1840 .RS 4
1841 .ie n \{\
1842 \h'-04'\(bu\h'+03'\c
1843 .\}
1844 .el \{\
1845 .sp -1
1846 .IP \(bu 2.3
1847 .\}
1848 https://wiki\&.mozilla\&.org/NSS_Shared_DB
1849 .RE
1850 .SH "ADDITIONAL RESOURCES"
1851 .PP
1852 For information about NSS and other tools related to NSS (like JSS), check out the NSS project wiki at
1853 \m[blue]\fBhttp://www\&.mozilla\&.org/projects/security/pki/nss/\fR\m[]\&. The NSS site relates directly to NSS code changes and releases\&.
1854 .PP
1855 Mailing lists: https://lists\&.mozilla\&.org/listinfo/dev\-tech\-crypto
1856 .PP
1857 IRC: Freenode at #dogtag\-pki
1858 .SH "AUTHORS"
1859 .PP
1860 The NSS tools were written and maintained by developers with Netscape, Red Hat, Sun, Oracle, Mozilla, and Google\&.
1861 .PP
1862 Authors: Elio Maldonado <emaldona@redhat\&.com>, Deon Lackey <dlackey@redhat\&.com>\&.
1863 .SH "LICENSE"
1864 .PP
1865 Licensed under the Mozilla Public License, v\&. 2\&.0\&. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla\&.org/MPL/2\&.0/\&.
1866 .SH "NOTES"
1867 .IP " 1." 4
1868 Mozilla NSS bug 836477
1869 .RS 4
1870 \%https://bugzilla.mozilla.org/show_bug.cgi?id=836477
1871 .RE