1CERTUTIL(1)                   NSS Security Tools                   CERTUTIL(1)
2
3
4

NAME

6       certutil - Manage keys and certificate in both NSS databases and other
7       NSS tokens
8

SYNOPSIS

10       certutil [options] [[arguments]]
11

STATUS

13       This documentation is still work in progress. Please contribute to the
14       initial review in Mozilla NSS bug 836477[1]
15

DESCRIPTION

17       The Certificate Database Tool, certutil, is a command-line utility that
18       can create and modify certificate and key databases. It can
19       specifically list, generate, modify, or delete certificates, create or
20       change the password, generate new public and private key pairs, display
21       the contents of the key database, or delete key pairs within the key
22       database.
23
24       Certificate issuance, part of the key and certificate management
25       process, requires that keys and certificates be created in the key
26       database. This document discusses certificate and key database
27       management. For information on the security module database management,
28       see the modutil manpage.
29

COMMAND OPTIONS AND ARGUMENTS

31       Running certutil always requires one and only one command option to
32       specify the type of certificate operation. Each command option may take
33       zero or more arguments. The command option -H will list all the command
34       options and their relevant arguments.
35
36       Command Options
37
38       -A
39           Add an existing certificate to a certificate database. The
40           certificate database should already exist; if one is not present,
41           this command option will initialize one by default.
42
43       -B
44           Run a series of commands from the specified batch file. This
45           requires the -i argument.
46
47       -C
48           Create a new binary certificate file from a binary certificate
49           request file. Use the -i argument to specify the certificate
50           request file. If this argument is not used, certutil prompts for a
51           filename.
52
53       -D
54           Delete a certificate from the certificate database.
55
56       --rename
57           Change the database nickname of a certificate.
58
59       -E
60           Add an email certificate to the certificate database.
61
62       -F
63           Delete a private key and the associated certificate from a
64           database. Specify the key to delete with the -n argument or the -k
65           argument. Specify the database from which to delete the key with
66           the -d argument.
67
68           Some smart cards do not let you remove a public key you have
69           generated. In such a case, only the private key is deleted from the
70           key pair.
71
72       -G
73           Generate a new public and private key pair within a key database.
74           The key database should already exist; if one is not present, this
75           command option will initialize one by default. Some smart cards can
76           store only one key pair. If you create a new key pair for such a
77           card, the previous pair is overwritten.
78
79       -H
80           Display a list of the command options and arguments.
81
82       -K
83           List the key ID of keys in the key database. A key ID is the
84           modulus of the RSA key or the publicValue of the DSA key. IDs are
85           displayed in hexadecimal ("0x" is not shown).
86
87       -L
88           List all the certificates, or display information about a named
89           certificate, in a certificate database. Use the -h tokenname
90           argument to specify the certificate database on a particular
91           hardware or software token.
92
93       -M
94           Modify a certificate's trust attributes using the values of the -t
95           argument.
96
97       -N
98           Create new certificate and key databases.
99
100       -O
101           Print the certificate chain.
102
103       -R
104           Create a certificate request file that can be submitted to a
105           Certificate Authority (CA) for processing into a finished
106           certificate. Output defaults to standard out unless you use -o
107           output-file argument. Use the -a argument to specify ASCII output.
108
109       -S
110           Create an individual certificate and add it to a certificate
111           database.
112
113       -T
114           Reset the key database or token.
115
116       -U
117           List all available modules or print a single named module.
118
119       -V
120           Check the validity of a certificate and its attributes.
121
122       -W
123           Change the password to a key database.
124
125       --merge
126           Merge two databases into one.
127
128       --upgrade-merge
129           Upgrade an old database and merge it into a new database. This is
130           used to migrate legacy NSS databases (cert8.db and key3.db) into
131           the newer SQLite databases (cert9.db and key4.db).
132
133       Arguments
134
135       Arguments modify a command option and are usually lower case, numbers,
136       or symbols.
137
138       -a
139           Use ASCII format or allow the use of ASCII format for input or
140           output. This formatting follows RFC 1113. For certificate requests,
141           ASCII output defaults to standard output unless redirected.
142
143       --simple-self-signed
144           When printing the certificate chain, don't search for a chain if
145           issuer name equals to subject name.
146
147       -b validity-time
148           Specify a time at which a certificate is required to be valid. Use
149           when checking certificate validity with the -V option. The format
150           of the validity-time argument is YYMMDDHHMMSS[+HHMM|-HHMM|Z], which
151           allows offsets to be set relative to the validity end time.
152           Specifying seconds (SS) is optional. When specifying an explicit
153           time, use a Z at the end of the term, YYMMDDHHMMSSZ, to close it.
154           When specifying an offset time, use YYMMDDHHMMSS+HHMM or
155           YYMMDDHHMMSS-HHMM for adding or subtracting time, respectively.
156
157           If this option is not used, the validity check defaults to the
158           current system time.
159
160       -c issuer
161           Identify the certificate of the CA from which a new certificate
162           will derive its authenticity. Use the exact nickname or alias of
163           the CA certificate, or use the CA's email address. Bracket the
164           issuer string with quotation marks if it contains spaces.
165
166       -d [prefix]directory
167           Specify the database directory containing the certificate and key
168           database files.
169
170           certutil supports two types of databases: the legacy security
171           databases (cert8.db, key3.db, and secmod.db) and new SQLite
172           databases (cert9.db, key4.db, and pkcs11.txt).
173
174           NSS recognizes the following prefixes:
175
176sql: requests the sql-lite database
177
178           If no prefix is specified the default type is retrieved from
179           NSS_DEFAULT_DB_TYPE. If NSS_DEFAULT_DB_TYPE is not set then sql: is
180           the default.
181
182       --dump-ext-val OID
183           For single cert, print binary DER encoding of extension OID.
184
185       -e
186           Check a certificate's signature during the process of validating a
187           certificate.
188
189       --email email-address
190           Specify the email address of a certificate to list. Used with the
191           -L command option.
192
193       --extGeneric OID:critical-flag:filename[,OID:critical-flag:filename]...
194           Add one or multiple extensions that certutil cannot encode yet, by
195           loading their encodings from external files.
196
197           •   OID (example): 1.2.3.4
198
199           •   critical-flag: critical or not-critical
200
201           •   filename: full path to a file containing an encoded extension
202
203       -f password-file
204           Specify a file that will automatically supply the password to
205           include in a certificate or to access a certificate database. This
206           is a plain-text file containing one password. Be sure to prevent
207           unauthorized access to this file.
208
209       -g keysize
210           Set a key size to use when generating new public and private key
211           pairs. The minimum is 512 bits and the maximum is 16384 bits. The
212           default is 2048 bits. Any size between the minimum and maximum is
213           allowed.
214
215       -h tokenname
216           Specify the name of a token to use or act on. If not specified the
217           default token is the internal database slot.
218
219           The name can also be a PKCS #11 URI. For example, the NSS internal
220           certificate store can be unambiguously specified as
221           "pkcs11:token=NSS%20Certificate%20DB". For details about the
222           format, see RFC 7512.
223
224       -i input_file
225           Pass an input file to the command. Depending on the command option,
226           an input file can be a specific certificate, a certificate request
227           file, or a batch file of commands.
228
229       -k key-type-or-id
230           Specify the type or specific ID of a key.
231
232           The valid key type options are rsa, dsa, ec, or all. The default
233           value is rsa. Specifying the type of key can avoid mistakes caused
234           by duplicate nicknames. Giving a key type generates a new key pair;
235           giving the ID of an existing key reuses that key pair (which is
236           required to renew certificates).
237
238       -l
239           Display detailed information when validating a certificate with the
240           -V option.
241
242       -m serial-number
243           Assign a unique serial number to a certificate being created. This
244           operation should be performed by a CA. If no serial number is
245           provided a default serial number is made from the current time.
246           Serial numbers are limited to integers
247
248       -n nickname
249           Specify the nickname of a certificate or key to list, create, add
250           to a database, modify, or validate. Bracket the nickname string
251           with quotation marks if it contains spaces.
252
253           The nickname can also be a PKCS #11 URI. For example, if you have a
254           certificate named "my-server-cert" on the internal certificate
255           store, it can be unambiguously specified as
256           "pkcs11:token=NSS%20Certificate%20DB;object=my-server-cert". For
257           details about the format, see RFC 7512.
258
259       -o output-file
260           Specify the output file name for new certificates or binary
261           certificate requests. Bracket the output-file string with quotation
262           marks if it contains spaces. If this argument is not used the
263           output destination defaults to standard output.
264
265       -P dbPrefix
266           Specify the prefix used on the certificate and key database file.
267           This argument is provided to support legacy servers. Most
268           applications do not use a database prefix.
269
270       -p phone
271           Specify a contact telephone number to include in new certificates
272           or certificate requests. Bracket this string with quotation marks
273           if it contains spaces.
274
275       -q pqgfile or curve-name
276           Read an alternate PQG value from the specified file when generating
277           DSA key pairs. If this argument is not used, certutil generates its
278           own PQG value. PQG files are created with a separate DSA utility.
279
280           Elliptic curve name is one of the ones from nistp256, nistp384,
281           nistp521, curve25519.
282
283           If a token is available that supports more curves, the foolowing
284           curves are supported as well: sect163k1, nistk163, sect163r1,
285           sect163r2, nistb163, sect193r1, sect193r2, sect233k1, nistk233,
286           sect233r1, nistb233, sect239k1, sect283k1, nistk283, sect283r1,
287           nistb283, sect409k1, nistk409, sect409r1, nistb409, sect571k1,
288           nistk571, sect571r1, nistb571, secp160k1, secp160r1, secp160r2,
289           secp192k1, secp192r1, nistp192, secp224k1, secp224r1, nistp224,
290           secp256k1, secp256r1, secp384r1, secp521r1, prime192v1, prime192v2,
291           prime192v3, prime239v1, prime239v2, prime239v3, c2pnb163v1,
292           c2pnb163v2, c2pnb163v3, c2pnb176v1, c2tnb191v1, c2tnb191v2,
293           c2tnb191v3, c2pnb208w1, c2tnb239v1, c2tnb239v2, c2tnb239v3,
294           c2pnb272w1, c2pnb304w1, c2tnb359w1, c2pnb368w1, c2tnb431r1,
295           secp112r1, secp112r2, secp128r1, secp128r2, sect113r1, sect113r2,
296           sect131r1, sect131r2
297
298       -r
299           Display a certificate's binary DER encoding when listing
300           information about that certificate with the -L option.
301
302       -s subject
303           Identify a particular certificate owner for new certificates or
304           certificate requests. Bracket this string with quotation marks if
305           it contains spaces. The subject identification format follows RFC
306           #1485.
307
308       -t trustargs
309           Specify the trust attributes to modify in an existing certificate
310           or to apply to a certificate when creating it or adding it to a
311           database. There are three available trust categories for each
312           certificate, expressed in the order SSL, email, object signing for
313           each trust setting. In each category position, use none, any, or
314           all of the attribute codes:
315
316p - Valid peer
317
318P - Trusted peer (implies p)
319
320c - Valid CA
321
322C - Trusted CA (implies c)
323
324T - trusted CA for client authentication (ssl server only)
325
326           The attribute codes for the categories are separated by commas, and
327           the entire set of attributes enclosed by quotation marks. For
328           example:
329
330           -t "TC,C,T"
331
332           Use the -L option to see a list of the current certificates and
333           trust attributes in a certificate database.
334
335           Note that the output of the -L option may include "u" flag, which
336           means that there is a private key associated with the certificate.
337           It is a dynamic flag and you cannot set it with certutil.
338
339       -u certusage
340           Specify a usage context to apply when validating a certificate with
341           the -V option.
342
343           The contexts are the following:
344
345C (as an SSL client)
346
347V (as an SSL server)
348
349L (as an SSL CA)
350
351A (as Any CA)
352
353Y (Verify CA)
354
355S (as an email signer)
356
357R (as an email recipient)
358
359O (as an OCSP status responder)
360
361J (as an object signer)
362
363I (as an IPSEC user)
364
365       -v valid-months
366           Set the number of months a new certificate will be valid. The
367           validity period begins at the current system time unless an offset
368           is added or subtracted with the -w option. If this argument is not
369           used, the default validity period is three months.
370
371       -w offset-months
372           Set an offset from the current system time, in months, for the
373           beginning of a certificate's validity period. Use when creating the
374           certificate or adding it to a database. Express the offset in
375           integers, using a minus sign (-) to indicate a negative offset. If
376           this argument is not used, the validity period begins at the
377           current system time. The length of the validity period is set with
378           the -v argument.
379
380       -X
381           Force the key and certificate database to open in read-write mode.
382           This is used with the -U and -L command options.
383
384       -x
385           Use certutil to generate the signature for a certificate being
386           created or added to a database, rather than obtaining a signature
387           from a separate CA.
388
389       -y exp
390           Set an alternate exponent value to use in generating a new RSA
391           public key for the database, instead of the default value of 65537.
392           The available alternate values are 3 and 17.
393
394       --pss
395           Restrict the generated certificate (with the -S option) or
396           certificate request (with the -R option) to be used with the
397           RSA-PSS signature scheme. This only works when the private key of
398           the certificate or certificate request is RSA.
399
400       --pss-sign
401           Sign the generated certificate with the RSA-PSS signature scheme
402           (with the -C or -S option). This only works when the private key of
403           the signer's certificate is RSA. If the signer's certificate is
404           restricted to RSA-PSS, it is not necessary to specify this option.
405
406       -z noise-file
407           Read a seed value from the specified file to generate a new private
408           and public key pair. This argument makes it possible to use
409           hardware-generated seed values or manually create a value from the
410           keyboard. The minimum file size is 20 bytes.
411
412       -Z hashAlg
413           Specify the hash algorithm to use with the -C, -S or -R command
414           options. Possible keywords:
415
416           •   MD2
417
418           •   MD4
419
420           •   MD5
421
422           •   SHA1
423
424           •   SHA224
425
426           •   SHA256
427
428           •   SHA384
429
430           •   SHA512
431
432       -0 SSO_password
433           Set a site security officer password on a token.
434
435       -1 | --keyUsage keyword,keyword
436           Set an X.509 V3 Certificate Type Extension in the certificate.
437           There are several available keywords:
438
439           •   digitalSignature
440
441           •   nonRepudiation
442
443           •   keyEncipherment
444
445           •   dataEncipherment
446
447           •   keyAgreement
448
449           •   certSigning
450
451           •   crlSigning
452
453           •   critical
454
455       -2
456           Add a basic constraint extension to a certificate that is being
457           created or added to a database. This extension supports the
458           certificate chain verification process.  certutil prompts for the
459           certificate constraint extension to select.
460
461           X.509 certificate extensions are described in RFC 5280.
462
463       -3
464           Add an authority key ID extension to a certificate that is being
465           created or added to a database. This extension supports the
466           identification of a particular certificate, from among multiple
467           certificates associated with one subject name, as the correct
468           issuer of a certificate. The Certificate Database Tool will prompt
469           you to select the authority key ID extension.
470
471           X.509 certificate extensions are described in RFC 5280.
472
473       -4
474           Add a CRL distribution point extension to a certificate that is
475           being created or added to a database. This extension identifies the
476           URL of a certificate's associated certificate revocation list
477           (CRL).  certutil prompts for the URL.
478
479           X.509 certificate extensions are described in RFC 5280.
480
481       -5 | --nsCertType keyword,keyword
482           Add an X.509 V3 certificate type extension to a certificate that is
483           being created or added to the database. There are several available
484           keywords:
485
486           •   sslClient
487
488           •   sslServer
489
490           •   smime
491
492           •   objectSigning
493
494           •   sslCA
495
496           •   smimeCA
497
498           •   objectSigningCA
499
500           •   critical
501
502           X.509 certificate extensions are described in RFC 5280.
503
504       -6 | --extKeyUsage keyword,keyword
505           Add an extended key usage extension to a certificate that is being
506           created or added to the database. Several keywords are available:
507
508           •   serverAuth
509
510           •   clientAuth
511
512           •   codeSigning
513
514           •   emailProtection
515
516           •   timeStamp
517
518           •   ocspResponder
519
520           •   stepUp
521
522           •   msTrustListSign
523
524           •   critical
525
526           •   x509Any
527
528           •   ipsecIKE
529
530           •   ipsecIKEEnd
531
532           •   ipsecIKEIntermediate
533
534           •   ipsecEnd
535
536           •   ipsecTunnel
537
538           •   ipsecUser
539
540           X.509 certificate extensions are described in RFC 5280.
541
542       -7 emailAddrs
543           Add a comma-separated list of email addresses to the subject
544           alternative name extension of a certificate or certificate request
545           that is being created or added to the database. Subject alternative
546           name extensions are described in Section 4.2.1.7 of RFC 3280.
547
548       -8 dns-names
549           Add a comma-separated list of DNS names to the subject alternative
550           name extension of a certificate or certificate request that is
551           being created or added to the database. Subject alternative name
552           extensions are described in Section 4.2.1.7 of RFC 3280.
553
554       --extAIA
555           Add the Authority Information Access extension to the certificate.
556           X.509 certificate extensions are described in RFC 5280.
557
558       --extSIA
559           Add the Subject Information Access extension to the certificate.
560           X.509 certificate extensions are described in RFC 5280.
561
562       --extCP
563           Add the Certificate Policies extension to the certificate. X.509
564           certificate extensions are described in RFC 5280.
565
566       --extPM
567           Add the Policy Mappings extension to the certificate. X.509
568           certificate extensions are described in RFC 5280.
569
570       --extPC
571           Add the Policy Constraints extension to the certificate. X.509
572           certificate extensions are described in RFC 5280.
573
574       --extIA
575           Add the Inhibit Any Policy Access extension to the certificate.
576           X.509 certificate extensions are described in RFC 5280.
577
578       --extSKID
579           Add the Subject Key ID extension to the certificate. X.509
580           certificate extensions are described in RFC 5280.
581
582       --extNC
583           Add a Name Constraint extension to the certificate. X.509
584           certificate extensions are described in RFC 5280.
585
586       --extSAN type:name[,type:name]...
587           Create a Subject Alt Name extension with one or multiple names.
588
589           -type: directory, dn, dns, edi, ediparty, email, ip, ipaddr, other,
590           registerid, rfc822, uri, x400, x400addr
591
592       --empty-password
593           Use empty password when creating new certificate database with -N.
594
595       --keyAttrFlags attrflags
596           PKCS #11 key Attributes. Comma separated list of key attribute
597           flags, selected from the following list of choices: {token |
598           session} {public | private} {sensitive | insensitive} {modifiable |
599           unmodifiable} {extractable | unextractable}
600
601       --keyOpFlagsOn opflags, --keyOpFlagsOff opflags
602           PKCS #11 key Operation Flags. Comma separated list of one or more
603           of the following: {token | session} {public | private} {sensitive |
604           insensitive} {modifiable | unmodifiable} {extractable |
605           unextractable}
606
607       --new-n nickname
608           A new nickname, used when renaming a certificate.
609
610       --source-dir certdir
611           Identify the certificate database directory to upgrade.
612
613       --source-prefix certdir
614           Give the prefix of the certificate and key databases to upgrade.
615
616       --upgrade-id uniqueID
617           Give the unique ID of the database to upgrade.
618
619       --upgrade-token-name name
620           Set the name of the token to use while it is being upgraded.
621
622       -@ pwfile
623           Give the name of a password file to use for the database being
624           upgraded.
625

USAGE AND EXAMPLES

627       Most of the command options in the examples listed here have more
628       arguments available. The arguments included in these examples are the
629       most common ones or are used to illustrate a specific scenario. Use the
630       -H option to show the complete list of arguments for each command
631       option.
632
633       Creating New Security Databases
634
635       Certificates, keys, and security modules related to managing
636       certificates are stored in three related databases:
637
638       •   cert8.db or cert9.db
639
640       •   key3.db or key4.db
641
642       •   secmod.db or pkcs11.txt
643
644       These databases must be created before certificates or keys can be
645       generated.
646
647           certutil -N -d directory
648
649       Creating a Certificate Request
650
651       A certificate request contains most or all of the information that is
652       used to generate the final certificate. This request is submitted
653       separately to a certificate authority and is then approved by some
654       mechanism (automatically or by human review). Once the request is
655       approved, then the certificate is generated.
656
657           $ certutil -R -k key-type-or-id [-q pqgfile|curve-name] -g key-size -s subject [-h tokenname] -d directory [-p phone] [-o output-file] [-a]
658
659       The -R command options requires four arguments:
660
661-k to specify either the key type to generate or, when renewing a
662           certificate, the existing key pair to use
663
664-g to set the keysize of the key to generate
665
666-s to set the subject name of the certificate
667
668-d to give the security database directory
669
670       The new certificate request can be output in ASCII format (-a) or can
671       be written to a specified file (-o).
672
673       For example:
674
675           $ certutil -R -k rsa -g 1024 -s "CN=John Smith,O=Example Corp,L=Mountain View,ST=California,C=US" -d $HOME/nssdb -p 650-555-0123 -a -o cert.cer
676
677           Generating key.  This may take a few moments...
678
679
680       Creating a Certificate
681
682       A valid certificate must be issued by a trusted CA. This can be done by
683       specifying a CA certificate (-c) that is stored in the certificate
684       database. If a CA key pair is not available, you can create a
685       self-signed certificate using the -x argument with the -S command
686       option.
687
688           $ certutil -S -k rsa|dsa|ec -n certname -s subject [-c issuer |-x] -t trustargs -d 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]
689
690       The series of numbers and --ext* options set certificate extensions
691       that can be added to the certificate when it is generated by the CA.
692       Interactive prompts will result.
693
694       For example, this creates a self-signed certificate:
695
696           $ certutil -S -s "CN=Example CA" -n my-ca-cert -x -t "C,C,C" -1 -2 -5 -m 3650
697
698       The interative prompts for key usage and whether any extensions are
699       critical and responses have been ommitted for brevity.
700
701       From there, new certificates can reference the self-signed certificate:
702
703           $ certutil -S -s "CN=My Server Cert" -n my-server-cert -c "my-ca-cert" -t ",," -1 -5 -6 -8 -m 730
704
705       Generating a Certificate from a Certificate Request
706
707       When a certificate request is created, a certificate can be generated
708       by using the request and then referencing a certificate authority
709       signing certificate (the issuer specified in the -c argument). The
710       issuing certificate must be in the certificate database in the
711       specified directory.
712
713           certutil -C -c issuer -i cert-request-file -o output-file [-m serial-number] [-v valid-months] [-w offset-months] -d directory [-1] [-2] [-3] [-4] [-5 keyword] [-6 keyword] [-7 emailAddress] [-8 dns-names]
714
715       For example:
716
717           $ certutil -C -c "my-ca-cert" -i /home/certs/cert.req -o cert.cer -m 010 -v 12 -w 1 -d $HOME/nssdb -1 nonRepudiation,dataEncipherment -5 sslClient -6 clientAuth -7 jsmith@example.com
718
719       Listing Certificates
720
721       The -L command option lists all of the certificates listed in the
722       certificate database. The path to the directory (-d) is required.
723
724           $ certutil -L -d /home/my/sharednssdb
725
726           Certificate Nickname                                         Trust Attributes
727                                                                        SSL,S/MIME,JAR/XPI
728
729           CA Administrator of Instance pki-ca1's Example Domain ID     u,u,u
730           TPS Administrator's Example Domain ID                        u,u,u
731           Google Internet Authority                                    ,,
732           Certificate Authority - Example Domain                       CT,C,C
733
734       Using additional arguments with -L can return and print the information
735       for a single, specific certificate. For example, the -n argument passes
736       the certificate name, while the -a argument prints the certificate in
737       ASCII format:
738
739           $ certutil -L -d $HOME/nssdb -a -n my-ca-cert
740           -----BEGIN CERTIFICATE-----
741           MIIB1DCCAT2gAwIBAgICDkIwDQYJKoZIhvcNAQEFBQAwFTETMBEGA1UEAxMKRXhh
742           bXBsZSBDQTAeFw0xMzAzMTMxOTEwMjlaFw0xMzA2MTMxOTEwMjlaMBUxEzARBgNV
743           BAMTCkV4YW1wbGUgQ0EwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAJ4Kzqvz
744           JyBVgFqDXRYSyTBNw1DrxUU/3GvWA/ngjAwHEv0Cul/6sO/gsCvnABHiH6unns6x
745           XRzPORlC2WY3gkk7vmlsLvYpyecNazAi/NAwVnU/66HOsaoVFWE+gBQo99UrN2yk
746           0BiK/GMFlLm5dXQROgA9ZKKyFdI0LIXtf6SbAgMBAAGjMzAxMBEGCWCGSAGG+EIB
747           AQQEAwIHADAMBgNVHRMEBTADAQH/MA4GA1UdDwEB/wQEAwICBDANBgkqhkiG9w0B
748           AQUFAAOBgQA6chkzkACN281d1jKMrc+RHG2UMaQyxiteaLVZO+Ro1nnRUvseDf09
749           XKYFwPMJjWCihVku6bw/ihZfuMHhxK22Nue6inNQ6eDu7WmrqL8z3iUrQwxs+WiF
750           ob2rb8XRVVJkzXdXxlk4uo3UtNvw8sAz7sWD71qxKaIHU5q49zijfg==
751           -----END CERTIFICATE-----
752
753       For a human-readable display
754
755           $ certutil -L -d $HOME/nssdb -n my-ca-cert
756           Certificate:
757               Data:
758                   Version: 3 (0x2)
759                   Serial Number: 3650 (0xe42)
760                   Signature Algorithm: PKCS #1 SHA-1 With RSA Encryption
761                   Issuer: "CN=Example CA"
762                   Validity:
763                       Not Before: Wed Mar 13 19:10:29 2013
764                       Not After : Thu Jun 13 19:10:29 2013
765                   Subject: "CN=Example CA"
766                   Subject Public Key Info:
767                       Public Key Algorithm: PKCS #1 RSA Encryption
768                       RSA Public Key:
769                           Modulus:
770                               9e:0a:ce:ab:f3:27:20:55:80:5a:83:5d:16:12:c9:30:
771                               4d:c3:50:eb:c5:45:3f:dc:6b:d6:03:f9:e0:8c:0c:07:
772                               12:fd:02:ba:5f:fa:b0:ef:e0:b0:2b:e7:00:11:e2:1f:
773                               ab:a7:9e:ce:b1:5d:1c:cf:39:19:42:d9:66:37:82:49:
774                               3b:be:69:6c:2e:f6:29:c9:e7:0d:6b:30:22:fc:d0:30:
775                               56:75:3f:eb:a1:ce:b1:aa:15:15:61:3e:80:14:28:f7:
776                               d5:2b:37:6c:a4:d0:18:8a:fc:63:05:94:b9:b9:75:74:
777                               11:3a:00:3d:64:a2:b2:15:d2:34:2c:85:ed:7f:a4:9b
778                           Exponent: 65537 (0x10001)
779                   Signed Extensions:
780                       Name: Certificate Type
781                       Data: none
782
783                       Name: Certificate Basic Constraints
784                       Data: Is a CA with no maximum path length.
785
786                       Name: Certificate Key Usage
787                       Critical: True
788                       Usages: Certificate Signing
789
790               Signature Algorithm: PKCS #1 SHA-1 With RSA Encryption
791               Signature:
792                   3a:72:19:33:90:00:8d:db:cd:5d:d6:32:8c:ad:cf:91:
793                   1c:6d:94:31:a4:32:c6:2b:5e:68:b5:59:3b:e4:68:d6:
794                   79:d1:52:fb:1e:0d:fd:3d:5c:a6:05:c0:f3:09:8d:60:
795                   a2:85:59:2e:e9:bc:3f:8a:16:5f:b8:c1:e1:c4:ad:b6:
796                   36:e7:ba:8a:73:50:e9:e0:ee:ed:69:ab:a8:bf:33:de:
797                   25:2b:43:0c:6c:f9:68:85:a1:bd:ab:6f:c5:d1:55:52:
798                   64:cd:77:57:c6:59:38:ba:8d:d4:b4:db:f0:f2:c0:33:
799                   ee:c5:83:ef:5a:b1:29:a2:07:53:9a:b8:f7:38:a3:7e
800               Fingerprint (MD5):
801                   86:D8:A5:8B:8A:26:BE:9E:17:A8:7B:66:10:6B:27:80
802               Fingerprint (SHA1):
803                   48:78:09:EF:C5:D4:0C:BD:D2:64:45:59:EB:03:13:15:F7:A9:D6:F7
804
805               Certificate Trust Flags:
806                   SSL Flags:
807                       Valid CA
808                       Trusted CA
809                       User
810                   Email Flags:
811                       Valid CA
812                       Trusted CA
813                       User
814                   Object Signing Flags:
815                       Valid CA
816                       Trusted CA
817                       User
818
819
820       Listing Keys
821
822       Keys are the original material used to encrypt certificate data. The
823       keys generated for certificates are stored separately, in the key
824       database.
825
826       To list all keys in the database, use the -K command option and the
827       (required) -d argument to give the path to the directory.
828
829           $ certutil -K -d $HOME/nssdb
830           certutil: Checking token "NSS Certificate DB" in slot "NSS User Private Key and Certificate Services                  "
831           < 0> rsa      455a6673bde9375c2887ec8bf8016b3f9f35861d   Thawte Freemail Member's Thawte Consulting (Pty) Ltd. ID
832           < 1> rsa      40defeeb522ade11090eacebaaf1196a172127df   Example Domain Administrator Cert
833           < 2> rsa      1d0b06f44f6c03842f7d4f4a1dc78b3bcd1b85a5   John Smith user cert
834
835       There are ways to narrow the keys listed in the search results:
836
837       •   To return a specific key, use the -n name argument with the name of
838           the key.
839
840       •   If there are multiple security devices loaded, then the -h
841           tokenname argument can search a specific token or all tokens.
842
843       •   If there are multiple key types available, then the -k key-type
844           argument can search a specific type of key, like RSA, DSA, or ECC.
845
846       Listing Security Modules
847
848       The devices that can be used to store certificates -- both internal
849       databases and external devices like smart cards -- are recognized and
850       used by loading security modules. The -U command option lists all of
851       the security modules listed in the secmod.db database. The path to the
852       directory (-d) is required.
853
854           $ certutil -U -d /home/my/sharednssdb
855
856               slot: NSS User Private Key and Certificate Services
857              token: NSS Certificate DB
858                uri: pkcs11:token=NSS%20Certificate%20DB;manufacturer=Mozilla%20Foundation;serial=0000000000000000;model=NSS%203
859
860               slot: NSS Internal Cryptographic Services
861              token: NSS Generic Crypto Services
862                uri: pkcs11:token=NSS%20Generic%20Crypto%20Services;manufacturer=Mozilla%20Foundation;serial=0000000000000000;model=NSS%203
863
864       Adding Certificates to the Database
865
866       Existing certificates or certificate requests can be added manually to
867       the certificate database, even if they were generated elsewhere. This
868       uses the -A command option.
869
870           certutil -A -n certname -t trustargs -d directory [-a] [-i input-file]
871
872       For example:
873
874           $ certutil -A -n "CN=My SSL Certificate" -t ",," -d /home/my/sharednssdb -i /home/example-certs/cert.cer
875
876       A related command option, -E, is used specifically to add email
877       certificates to the certificate database. The -E command has the same
878       arguments as the -A command. The trust arguments for certificates have
879       the format SSL,S/MIME,Code-signing, so the middle trust settings relate
880       most to email certificates (though the others can be set). For example:
881
882           $ certutil -E -n "CN=John Smith Email Cert" -t ",P," -d /home/my/sharednssdb -i /home/example-certs/email.cer
883
884       Deleting Certificates to the Database
885
886       Certificates can be deleted from a database using the -D option. The
887       only required options are to give the security database directory and
888       to identify the certificate nickname.
889
890           certutil -D -d directory -n "nickname"
891
892       For example:
893
894           $ certutil -D -d /home/my/sharednssdb -n "my-ssl-cert"
895
896       Validating Certificates
897
898       A certificate contains an expiration date in itself, and expired
899       certificates are easily rejected. However, certificates can also be
900       revoked before they hit their expiration date. Checking whether a
901       certificate has been revoked requires validating the certificate.
902       Validation can also be used to ensure that the certificate is only used
903       for the purposes it was initially issued for. Validation is carried out
904       by the -V command option.
905
906           certutil -V -n certificate-name [-b time] [-e] [-u cert-usage] -d directory
907
908       For example, to validate an email certificate:
909
910           $ certutil -V -n "John Smith's Email Cert" -e -u S,R -d /home/my/sharednssdb
911
912       Modifying Certificate Trust Settings
913
914       The trust settings (which relate to the operations that a certificate
915       is allowed to be used for) can be changed after a certificate is
916       created or added to the database. This is especially useful for CA
917       certificates, but it can be performed for any type of certificate.
918
919           certutil -M -n certificate-name -t trust-args -d directory
920
921       For example:
922
923           $ certutil -M -n "My CA Certificate" -d /home/my/sharednssdb -t "CT,CT,CT"
924
925       Printing the Certificate Chain
926
927       Certificates can be issued in chains because every certificate
928       authority itself has a certificate; when a CA issues a certificate, it
929       essentially stamps that certificate with its own fingerprint. The -O
930       prints the full chain of a certificate, going from the initial CA (the
931       root CA) through ever intermediary CA to the actual certificate. For
932       example, for an email certificate with two CAs in the chain:
933
934           $ certutil -d /home/my/sharednssdb -O -n "jsmith@example.com"
935           "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]
936
937             "Thawte Personal Freemail Issuing CA - Thawte Consulting" [CN=Thawte Personal Freemail Issuing CA,O=Thawte Consulting (Pty) Ltd.,C=ZA]
938
939               "(null)" [E=jsmith@example.com,CN=Thawte Freemail Member]
940
941       Resetting a Token
942
943       The device which stores certificates -- both external hardware devices
944       and internal software databases -- can be blanked and reused. This
945       operation is performed on the device which stores the data, not
946       directly on the security databases, so the location must be referenced
947       through the token name (-h) as well as any directory path. If there is
948       no external token used, the default value is internal.
949
950           certutil -T -d directory -h token-name -0 security-officer-password
951
952       Many networks have dedicated personnel who handle changes to security
953       tokens (the security officer). This person must supply the password to
954       access the specified token. For example:
955
956           $ certutil -T -d /home/my/sharednssdb -h nethsm -0 secret
957
958       Upgrading or Merging the Security Databases
959
960       Many networks or applications may be using older BerkeleyDB versions of
961       the certificate database (cert8.db). Databases can be upgraded to the
962       new SQLite version of the database (cert9.db) using the --upgrade-merge
963       command option or existing databases can be merged with the new
964       cert9.db databases using the ---merge command.
965
966       The --upgrade-merge command must give information about the original
967       database and then use the standard arguments (like -d) to give the
968       information about the new databases. The command also requires
969       information that the tool uses for the process to upgrade and write
970       over the original database.
971
972           certutil --upgrade-merge -d directory [-P dbprefix] --source-dir directory --source-prefix dbprefix --upgrade-id id --upgrade-token-name name [-@ password-file]
973
974       For example:
975
976           $ certutil --upgrade-merge -d /home/my/sharednssdb --source-dir /opt/my-app/alias/ --source-prefix serverapp- --upgrade-id 1 --upgrade-token-name internal
977
978       The --merge command only requires information about the location of the
979       original database; since it doesn't change the format of the database,
980       it can write over information without performing interim step.
981
982           certutil --merge -d directory [-P dbprefix] --source-dir directory --source-prefix dbprefix [-@ password-file]
983
984       For example:
985
986           $ certutil --merge -d /home/my/sharednssdb --source-dir /opt/my-app/alias/ --source-prefix serverapp-
987
988       Running certutil Commands from a Batch File
989
990       A series of commands can be run sequentially from a text file with the
991       -B command option. The only argument for this specifies the input file.
992
993           $ certutil -B -i /path/to/batch-file
994

NSS DATABASE TYPES

996       NSS originally used BerkeleyDB databases to store security information.
997       The last versions of these legacy databases are:
998
999       •   cert8.db for certificates
1000
1001       •   key3.db for keys
1002
1003       •   secmod.db for PKCS #11 module information
1004
1005       BerkeleyDB has performance limitations, though, which prevent it from
1006       being easily used by multiple applications simultaneously. NSS has some
1007       flexibility that allows applications to use their own, independent
1008       database engine while keeping a shared database and working around the
1009       access issues. Still, NSS requires more flexibility to provide a truly
1010       shared security database.
1011
1012       In 2009, NSS introduced a new set of databases that are SQLite
1013       databases rather than BerkeleyDB. These new databases provide more
1014       accessibility and performance:
1015
1016       •   cert9.db for certificates
1017
1018       •   key4.db for keys
1019
1020       •   pkcs11.txt, a listing of all of the PKCS #11 modules, contained in
1021           a new subdirectory in the security databases directory
1022
1023       Because the SQLite databases are designed to be shared, these are the
1024       shared database type.
1025
1026       By default, the tools (certutil, pk12util, modutil) assume that the
1027       given security databases use the SQLite type.
1028
1029https://wiki.mozilla.org/NSS_Shared_DB_Howto
1030
1031       For an engineering draft on the changes in the shared NSS databases,
1032       see the NSS project wiki:
1033
1034https://wiki.mozilla.org/NSS_Shared_DB
1035

SEE ALSO

1037       pk12util (1)
1038
1039       modutil (1)
1040
1041       certutil has arguments or operations that use features defined in
1042       several IETF RFCs.
1043
1044http://tools.ietf.org/html/rfc5280
1045
1046http://tools.ietf.org/html/rfc1113
1047
1048http://tools.ietf.org/html/rfc1485
1049
1050       The NSS wiki has information on the new database design and how to
1051       configure applications to use it.
1052
1053https://wiki.mozilla.org/NSS_Shared_DB_Howto
1054
1055https://wiki.mozilla.org/NSS_Shared_DB
1056

ADDITIONAL RESOURCES

1058       For information about NSS and other tools related to NSS (like JSS),
1059       check out the NSS project wiki at
1060       http://www.mozilla.org/projects/security/pki/nss/. The NSS site relates
1061       directly to NSS code changes and releases.
1062
1063       Mailing lists: https://lists.mozilla.org/listinfo/dev-tech-crypto
1064
1065       IRC: Freenode at #dogtag-pki
1066

AUTHORS

1068       The NSS tools were written and maintained by developers with Netscape,
1069       Red Hat, Sun, Oracle, Mozilla, and Google.
1070
1071       Authors: Elio Maldonado <emaldona@redhat.com>, Deon Lackey
1072       <dlackey@redhat.com>.
1073

LICENSE

1075       Licensed under the Mozilla Public License, v. 2.0. If a copy of the MPL
1076       was not distributed with this file, You can obtain one at
1077       http://mozilla.org/MPL/2.0/.
1078

NOTES

1080        1. Mozilla NSS bug 836477
1081           https://bugzilla.mozilla.org/show_bug.cgi?id=836477
1082
1083
1084
1085nss-tools                       2 December 2021                    CERTUTIL(1)
Impressum