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 newer database
177
178dbm: requests the legacy database
179
180           If no prefix is specified the default type is retrieved from
181           NSS_DEFAULT_DB_TYPE. If NSS_DEFAULT_DB_TYPE is not set then sql: is
182           the default.
183
184       --dump-ext-val OID
185           For single cert, print binary DER encoding of extension OID.
186
187       -e
188           Check a certificate's signature during the process of validating a
189           certificate.
190
191       --email email-address
192           Specify the email address of a certificate to list. Used with the
193           -L command option.
194
195       --extGeneric OID:critical-flag:filename[,OID:critical-flag:filename]...
196           Add one or multiple extensions that certutil cannot encode yet, by
197           loading their encodings from external files.
198
199           •   OID (example): 1.2.3.4
200
201           •   critical-flag: critical or not-critical
202
203           •   filename: full path to a file containing an encoded extension
204
205       -f password-file
206           Specify a file that will automatically supply the password to
207           include in a certificate or to access a certificate database. This
208           is a plain-text file containing one password. Be sure to prevent
209           unauthorized access to this file.
210
211       -g keysize
212           Set a key size to use when generating new public and private key
213           pairs. The minimum is 512 bits and the maximum is 16384 bits. The
214           default is 2048 bits. Any size between the minimum and maximum is
215           allowed.
216
217       -h tokenname
218           Specify the name of a token to use or act on. If not specified the
219           default token is the internal database slot.
220
221           The name can also be a PKCS #11 URI. For example, the NSS internal
222           certificate store can be unambiguously specified as
223           "pkcs11:token=NSS%20Certificate%20DB". For details about the
224           format, see RFC 7512.
225
226       -i input_file
227           Pass an input file to the command. Depending on the command option,
228           an input file can be a specific certificate, a certificate request
229           file, or a batch file of commands.
230
231       -k key-type-or-id
232           Specify the type or specific ID of a key.
233
234           The valid key type options are rsa, dsa, ec, or all. The default
235           value is rsa. Specifying the type of key can avoid mistakes caused
236           by duplicate nicknames. Giving a key type generates a new key pair;
237           giving the ID of an existing key reuses that key pair (which is
238           required to renew certificates).
239
240       -l
241           Display detailed information when validating a certificate with the
242           -V option.
243
244       -m serial-number
245           Assign a unique serial number to a certificate being created. This
246           operation should be performed by a CA. If no serial number is
247           provided a default serial number is made from the current time.
248           Serial numbers are limited to integers
249
250       -n nickname
251           Specify the nickname of a certificate or key to list, create, add
252           to a database, modify, or validate. Bracket the nickname string
253           with quotation marks if it contains spaces.
254
255           The nickname can also be a PKCS #11 URI. For example, if you have a
256           certificate named "my-server-cert" on the internal certificate
257           store, it can be unambiguously specified as
258           "pkcs11:token=NSS%20Certificate%20DB;object=my-server-cert". For
259           details about the format, see RFC 7512.
260
261       -o output-file
262           Specify the output file name for new certificates or binary
263           certificate requests. Bracket the output-file string with quotation
264           marks if it contains spaces. If this argument is not used the
265           output destination defaults to standard output.
266
267       -P dbPrefix
268           Specify the prefix used on the certificate and key database file.
269           This argument is provided to support legacy servers. Most
270           applications do not use a database prefix.
271
272       -p phone
273           Specify a contact telephone number to include in new certificates
274           or certificate requests. Bracket this string with quotation marks
275           if it contains spaces.
276
277       -q pqgfile or curve-name
278           Read an alternate PQG value from the specified file when generating
279           DSA key pairs. If this argument is not used, certutil generates its
280           own PQG value. PQG files are created with a separate DSA utility.
281
282           Elliptic curve name is one of the ones from nistp256, nistp384,
283           nistp521, curve25519.
284
285           If a token is available that supports more curves, the foolowing
286           curves are supported as well: sect163k1, nistk163, sect163r1,
287           sect163r2, nistb163, sect193r1, sect193r2, sect233k1, nistk233,
288           sect233r1, nistb233, sect239k1, sect283k1, nistk283, sect283r1,
289           nistb283, sect409k1, nistk409, sect409r1, nistb409, sect571k1,
290           nistk571, sect571r1, nistb571, secp160k1, secp160r1, secp160r2,
291           secp192k1, secp192r1, nistp192, secp224k1, secp224r1, nistp224,
292           secp256k1, secp256r1, secp384r1, secp521r1, prime192v1, prime192v2,
293           prime192v3, prime239v1, prime239v2, prime239v3, c2pnb163v1,
294           c2pnb163v2, c2pnb163v3, c2pnb176v1, c2tnb191v1, c2tnb191v2,
295           c2tnb191v3, c2pnb208w1, c2tnb239v1, c2tnb239v2, c2tnb239v3,
296           c2pnb272w1, c2pnb304w1, c2tnb359w1, c2pnb368w1, c2tnb431r1,
297           secp112r1, secp112r2, secp128r1, secp128r2, sect113r1, sect113r2,
298           sect131r1, sect131r2
299
300       -r
301           Display a certificate's binary DER encoding when listing
302           information about that certificate with the -L option.
303
304       -s subject
305           Identify a particular certificate owner for new certificates or
306           certificate requests. Bracket this string with quotation marks if
307           it contains spaces. The subject identification format follows RFC
308           #1485.
309
310       -t trustargs
311           Specify the trust attributes to modify in an existing certificate
312           or to apply to a certificate when creating it or adding it to a
313           database. There are three available trust categories for each
314           certificate, expressed in the order SSL, email, object signing for
315           each trust setting. In each category position, use none, any, or
316           all of the attribute codes:
317
318p - Valid peer
319
320P - Trusted peer (implies p)
321
322c - Valid CA
323
324C - Trusted CA (implies c)
325
326T - trusted CA for client authentication (ssl server only)
327
328           The attribute codes for the categories are separated by commas, and
329           the entire set of attributes enclosed by quotation marks. For
330           example:
331
332           -t "TC,C,T"
333
334           Use the -L option to see a list of the current certificates and
335           trust attributes in a certificate database.
336
337           Note that the output of the -L option may include "u" flag, which
338           means that there is a private key associated with the certificate.
339           It is a dynamic flag and you cannot set it with certutil.
340
341       -u certusage
342           Specify a usage context to apply when validating a certificate with
343           the -V option.
344
345           The contexts are the following:
346
347C (as an SSL client)
348
349V (as an SSL server)
350
351L (as an SSL CA)
352
353A (as Any CA)
354
355Y (Verify CA)
356
357S (as an email signer)
358
359R (as an email recipient)
360
361O (as an OCSP status responder)
362
363J (as an object signer)
364
365I (as an IPSEC user)
366
367       -v valid-months
368           Set the number of months a new certificate will be valid. The
369           validity period begins at the current system time unless an offset
370           is added or subtracted with the -w option. If this argument is not
371           used, the default validity period is three months.
372
373       -w offset-months
374           Set an offset from the current system time, in months, for the
375           beginning of a certificate's validity period. Use when creating the
376           certificate or adding it to a database. Express the offset in
377           integers, using a minus sign (-) to indicate a negative offset. If
378           this argument is not used, the validity period begins at the
379           current system time. The length of the validity period is set with
380           the -v argument.
381
382       -X
383           Force the key and certificate database to open in read-write mode.
384           This is used with the -U and -L command options.
385
386       -x
387           Use certutil to generate the signature for a certificate being
388           created or added to a database, rather than obtaining a signature
389           from a separate CA.
390
391       -y exp
392           Set an alternate exponent value to use in generating a new RSA
393           public key for the database, instead of the default value of 65537.
394           The available alternate values are 3 and 17.
395
396       --pss
397           Restrict the generated certificate (with the -S option) or
398           certificate request (with the -R option) to be used with the
399           RSA-PSS signature scheme. This only works when the private key of
400           the certificate or certificate request is RSA.
401
402       --pss-sign
403           Sign the generated certificate with the RSA-PSS signature scheme
404           (with the -C or -S option). This only works when the private key of
405           the signer's certificate is RSA. If the signer's certificate is
406           restricted to RSA-PSS, it is not necessary to specify this option.
407
408       -z noise-file
409           Read a seed value from the specified file to generate a new private
410           and public key pair. This argument makes it possible to use
411           hardware-generated seed values or manually create a value from the
412           keyboard. The minimum file size is 20 bytes.
413
414       -Z hashAlg
415           Specify the hash algorithm to use with the -C, -S or -R command
416           options. Possible keywords:
417
418           •   MD2
419
420           •   MD4
421
422           •   MD5
423
424           •   SHA1
425
426           •   SHA224
427
428           •   SHA256
429
430           •   SHA384
431
432           •   SHA512
433
434       -0 SSO_password
435           Set a site security officer password on a token.
436
437       -1 | --keyUsage keyword,keyword
438           Set an X.509 V3 Certificate Type Extension in the certificate.
439           There are several available keywords:
440
441           •   digitalSignature
442
443           •   nonRepudiation
444
445           •   keyEncipherment
446
447           •   dataEncipherment
448
449           •   keyAgreement
450
451           •   certSigning
452
453           •   crlSigning
454
455           •   critical
456
457       -2
458           Add a basic constraint extension to a certificate that is being
459           created or added to a database. This extension supports the
460           certificate chain verification process.  certutil prompts for the
461           certificate constraint extension to select.
462
463           X.509 certificate extensions are described in RFC 5280.
464
465       -3
466           Add an authority key ID extension to a certificate that is being
467           created or added to a database. This extension supports the
468           identification of a particular certificate, from among multiple
469           certificates associated with one subject name, as the correct
470           issuer of a certificate. The Certificate Database Tool will prompt
471           you to select the authority key ID extension.
472
473           X.509 certificate extensions are described in RFC 5280.
474
475       -4
476           Add a CRL distribution point extension to a certificate that is
477           being created or added to a database. This extension identifies the
478           URL of a certificate's associated certificate revocation list
479           (CRL).  certutil prompts for the URL.
480
481           X.509 certificate extensions are described in RFC 5280.
482
483       -5 | --nsCertType keyword,keyword
484           Add an X.509 V3 certificate type extension to a certificate that is
485           being created or added to the database. There are several available
486           keywords:
487
488           •   sslClient
489
490           •   sslServer
491
492           •   smime
493
494           •   objectSigning
495
496           •   sslCA
497
498           •   smimeCA
499
500           •   objectSigningCA
501
502           •   critical
503
504           X.509 certificate extensions are described in RFC 5280.
505
506       -6 | --extKeyUsage keyword,keyword
507           Add an extended key usage extension to a certificate that is being
508           created or added to the database. Several keywords are available:
509
510           •   serverAuth
511
512           •   clientAuth
513
514           •   codeSigning
515
516           •   emailProtection
517
518           •   timeStamp
519
520           •   ocspResponder
521
522           •   stepUp
523
524           •   msTrustListSign
525
526           •   critical
527
528           •   x509Any
529
530           •   ipsecIKE
531
532           •   ipsecIKEEnd
533
534           •   ipsecIKEIntermediate
535
536           •   ipsecEnd
537
538           •   ipsecTunnel
539
540           •   ipsecUser
541
542           X.509 certificate extensions are described in RFC 5280.
543
544       -7 emailAddrs
545           Add a comma-separated list of email addresses to the subject
546           alternative name extension of a certificate or certificate request
547           that is being created or added to the database. Subject alternative
548           name extensions are described in Section 4.2.1.7 of RFC 3280.
549
550       -8 dns-names
551           Add a comma-separated list of DNS names to the subject alternative
552           name extension of a certificate or certificate request that is
553           being created or added to the database. Subject alternative name
554           extensions are described in Section 4.2.1.7 of RFC 3280.
555
556       --extAIA
557           Add the Authority Information Access extension to the certificate.
558           X.509 certificate extensions are described in RFC 5280.
559
560       --extSIA
561           Add the Subject Information Access extension to the certificate.
562           X.509 certificate extensions are described in RFC 5280.
563
564       --extCP
565           Add the Certificate Policies extension to the certificate. X.509
566           certificate extensions are described in RFC 5280.
567
568       --extPM
569           Add the Policy Mappings extension to the certificate. X.509
570           certificate extensions are described in RFC 5280.
571
572       --extPC
573           Add the Policy Constraints extension to the certificate. X.509
574           certificate extensions are described in RFC 5280.
575
576       --extIA
577           Add the Inhibit Any Policy Access extension to the certificate.
578           X.509 certificate extensions are described in RFC 5280.
579
580       --extSKID
581           Add the Subject Key ID extension to the certificate. X.509
582           certificate extensions are described in RFC 5280.
583
584       --extNC
585           Add a Name Constraint extension to the certificate. X.509
586           certificate extensions are described in RFC 5280.
587
588       --extSAN type:name[,type:name]...
589           Create a Subject Alt Name extension with one or multiple names.
590
591           -type: directory, dn, dns, edi, ediparty, email, ip, ipaddr, other,
592           registerid, rfc822, uri, x400, x400addr
593
594       --empty-password
595           Use empty password when creating new certificate database with -N.
596
597       --keyAttrFlags attrflags
598           PKCS #11 key Attributes. Comma separated list of key attribute
599           flags, selected from the following list of choices: {token |
600           session} {public | private} {sensitive | insensitive} {modifiable |
601           unmodifiable} {extractable | unextractable}
602
603       --keyOpFlagsOn opflags, --keyOpFlagsOff opflags
604           PKCS #11 key Operation Flags. Comma separated list of one or more
605           of the following: {token | session} {public | private} {sensitive |
606           insensitive} {modifiable | unmodifiable} {extractable |
607           unextractable}
608
609       --new-n nickname
610           A new nickname, used when renaming a certificate.
611
612       --source-dir certdir
613           Identify the certificate database directory to upgrade.
614
615       --source-prefix certdir
616           Give the prefix of the certificate and key databases to upgrade.
617
618       --upgrade-id uniqueID
619           Give the unique ID of the database to upgrade.
620
621       --upgrade-token-name name
622           Set the name of the token to use while it is being upgraded.
623
624       -@ pwfile
625           Give the name of a password file to use for the database being
626           upgraded.
627

USAGE AND EXAMPLES

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

NSS DATABASE TYPES

998       NSS originally used BerkeleyDB databases to store security information.
999       The last versions of these legacy databases are:
1000
1001       •   cert8.db for certificates
1002
1003       •   key3.db for keys
1004
1005       •   secmod.db for PKCS #11 module information
1006
1007       BerkeleyDB has performance limitations, though, which prevent it from
1008       being easily used by multiple applications simultaneously. NSS has some
1009       flexibility that allows applications to use their own, independent
1010       database engine while keeping a shared database and working around the
1011       access issues. Still, NSS requires more flexibility to provide a truly
1012       shared security database.
1013
1014       In 2009, NSS introduced a new set of databases that are SQLite
1015       databases rather than BerkeleyDB. These new databases provide more
1016       accessibility and performance:
1017
1018       •   cert9.db for certificates
1019
1020       •   key4.db for keys
1021
1022       •   pkcs11.txt, a listing of all of the PKCS #11 modules, contained in
1023           a new subdirectory in the security databases directory
1024
1025       Because the SQLite databases are designed to be shared, these are the
1026       shared database type. The shared database type is preferred; the legacy
1027       format is included for backward compatibility.
1028
1029       By default, the tools (certutil, pk12util, modutil) assume that the
1030       given security databases use the SQLite type. Using the legacy
1031       databases must be manually specified by using the dbm: prefix with the
1032       given security directory. For example:
1033
1034           $ certutil -L -d dbm:/home/my/sharednssdb
1035
1036       To set the legacy database type as the default type for the tools, set
1037       the NSS_DEFAULT_DB_TYPE environment variable to dbm:
1038
1039           export NSS_DEFAULT_DB_TYPE="dbm"
1040
1041       This line can be set added to the ~/.bashrc file to make the change
1042       permanent.
1043
1044https://wiki.mozilla.org/NSS_Shared_DB_Howto
1045
1046       For an engineering draft on the changes in the shared NSS databases,
1047       see the NSS project wiki:
1048
1049https://wiki.mozilla.org/NSS_Shared_DB
1050

SEE ALSO

1052       pk12util (1)
1053
1054       modutil (1)
1055
1056       certutil has arguments or operations that use features defined in
1057       several IETF RFCs.
1058
1059http://tools.ietf.org/html/rfc5280
1060
1061http://tools.ietf.org/html/rfc1113
1062
1063http://tools.ietf.org/html/rfc1485
1064
1065       The NSS wiki has information on the new database design and how to
1066       configure applications to use it.
1067
1068https://wiki.mozilla.org/NSS_Shared_DB_Howto
1069
1070https://wiki.mozilla.org/NSS_Shared_DB
1071

ADDITIONAL RESOURCES

1073       For information about NSS and other tools related to NSS (like JSS),
1074       check out the NSS project wiki at
1075       http://www.mozilla.org/projects/security/pki/nss/. The NSS site relates
1076       directly to NSS code changes and releases.
1077
1078       Mailing lists: https://lists.mozilla.org/listinfo/dev-tech-crypto
1079
1080       IRC: Freenode at #dogtag-pki
1081

AUTHORS

1083       The NSS tools were written and maintained by developers with Netscape,
1084       Red Hat, Sun, Oracle, Mozilla, and Google.
1085
1086       Authors: Elio Maldonado <emaldona@redhat.com>, Deon Lackey
1087       <dlackey@redhat.com>.
1088

LICENSE

1090       Licensed under the Mozilla Public License, v. 2.0. If a copy of the MPL
1091       was not distributed with this file, You can obtain one at
1092       http://mozilla.org/MPL/2.0/.
1093

NOTES

1095        1. Mozilla NSS bug 836477
1096           https://bugzilla.mozilla.org/show_bug.cgi?id=836477
1097
1098
1099
1100nss-tools                         29 May 2021                      CERTUTIL(1)
Impressum