\fBcertutil\fR, is a command\-line utility that can create and modify certificate and key databases\&. It can specifically list, generate, modify, or delete certificates, create or change the password, generate new public and private key pairs, display the contents of the key database, or delete key pairs within the key database\&.
.PP
Certificate issuance, part of the key and certificate management process, requires that keys and certificates be created in the key database\&. This document discusses certificate and key database management\&. For information on the security module database management, see the
\fBmodutil\fR
manpage\&.
.SH"COMMAND OPTIONS AND ARGUMENTS"
.PP
Running
\fBcertutil\fR
always requires one and only one command option to specify the type of certificate operation\&. Each command option may take zero or more arguments\&. The command option
\fB\-H\fR
will list all the command options and their relevant arguments\&.
.PP
\fBCommand Options\fR
.PP
\-A
.RS4
Add an existing certificate to a certificate database\&. The certificate database should already exist; if one is not present, this command option will initialize one by default\&.
.RE
.PP
\-B
.RS4
Run a series of commands from the specified batch file\&. This requires the
\fB\-i\fR
argument\&.
.RE
.PP
\-C
.RS4
Create a new binary certificate file from a binary certificate request file\&. Use the
\fB\-i\fR
argument to specify the certificate request file\&. If this argument is not used,
\fBcertutil\fR
prompts for a filename\&.
.RE
.PP
\-D
.RS4
Delete a certificate from the certificate database\&.
Add an email certificate to the certificate database\&.
.RE
.PP
\-F
.RS4
Delete a private key from a key database\&. Specify the key to delete with the \-n argument\&. Specify the database from which to delete the key with the
\fB\-d\fR
argument\&. Use the
\fB\-k\fR
argument to specify explicitly whether to delete a DSA, RSA, or ECC key\&. If you don\*(Aqt use the
\fB\-k\fR
argument, the option looks for an RSA key matching the specified nickname\&.
.sp
When you delete keys, be sure to also remove any certificates associated with those keys from the certificate database, by using \-D\&. Some smart cards do not let you remove a public key you have generated\&. In such a case, only the private key is deleted from the key pair\&. You can display the public key with the command certutil \-K \-h tokenname\&.
.RE
.PP
\-G
.RS4
Generate a new public and private key pair within a key database\&. The key database should already exist; if one is not present, this command option will initialize one by default\&. Some smart cards can store only one key pair\&. If you create a new key pair for such a card, the previous pair is overwritten\&.
.RE
.PP
\-H
.RS4
Display a list of the command options and arguments\&.
.RE
.PP
\-K
.RS4
List the key ID of keys in the key database\&. A key ID is the modulus of the RSA key or the publicValue of the DSA key\&. IDs are displayed in hexadecimal ("0x" is not shown)\&.
.RE
.PP
\-L
.RS4
List all the certificates, or display information about a named certificate, in a certificate database\&. Use the \-h tokenname argument to specify the certificate database on a particular hardware or software token\&.
.RE
.PP
\-M
.RS4
Modify a certificate\*(Aqs trust attributes using the values of the \-t argument\&.
.RE
.PP
\-N
.RS4
Create new certificate and key databases\&.
.RE
.PP
\-O
.RS4
Print the certificate chain\&.
.RE
.PP
\-R
.RS4
Create a certificate request file that can be submitted to a Certificate Authority (CA) for processing into a finished certificate\&. Output defaults to standard out unless you use \-o output\-file argument\&. Use the \-a argument to specify ASCII output\&.
.RE
.PP
\-S
.RS4
Create an individual certificate and add it to a certificate database\&.
.RE
.PP
\-T
.RS4
Reset the key database or token\&.
.RE
.PP
\-U
.RS4
List all available modules or print a single named module\&.
.RE
.PP
\-V
.RS4
Check the validity of a certificate and its attributes\&.
.RE
.PP
\-W
.RS4
Change the password to a key database\&.
.RE
.PP
\-\-merge
.RS4
Merge two databases into one\&.
.RE
.PP
\-\-upgrade\-merge
.RS4
Upgrade an old database and merge it into a new database\&. This is used to migrate legacy NSS databases (cert8\&.db
and
key3\&.db) into the newer SQLite databases (cert9\&.db
and
key4\&.db)\&.
.RE
.PP
\fBArguments\fR
.PP
Arguments modify a command option and are usually lower case, numbers, or symbols\&.
.PP
\-a
.RS4
Use ASCII format or allow the use of ASCII format for input or output\&. This formatting follows RFC 1113\&. For certificate requests, ASCII output defaults to standard output unless redirected\&.
.RE
.PP
\-b validity\-time
.RS4
Specify a time at which a certificate is required to be valid\&. Use when checking certificate validity with the
\fB\-V\fR
option\&. The format of the
\fIvalidity\-time\fR
argument is
\fIYYMMDDHHMMSS[+HHMM|\-HHMM|Z]\fR, which allows offsets to be set relative to the validity end time\&. Specifying seconds (\fISS\fR) is optional\&. When specifying an explicit time, use a Z at the end of the term,
\fIYYMMDDHHMMSSZ\fR, to close it\&. When specifying an offset time, use
\fIYYMMDDHHMMSS+HHMM\fR
or
\fIYYMMDDHHMMSS\-HHMM\fR
for adding or subtracting time, respectively\&.
.sp
If this option is not used, the validity check defaults to the current system time\&.
.RE
.PP
\-c issuer
.RS4
Identify the certificate of the CA from which a new certificate will derive its authenticity\&. Use the exact nickname or alias of the CA certificate, or use the CA\*(Aqs email address\&. Bracket the issuer string with quotation marks if it contains spaces\&.
.RE
.PP
\-d [prefix]directory
.RS4
Specify the database directory containing the certificate and key database files\&.
.sp
\fBcertutil\fR
supports two types of databases: the legacy security databases (cert8\&.db,
key3\&.db, and
secmod\&.db) and new SQLite databases (cert9\&.db,
Specify a file that will automatically supply the password to include in a certificate or to access a certificate database\&. This is a plain\-text file containing one password\&. Be sure to prevent unauthorized access to this file\&.
Set a key size to use when generating new public and private key pairs\&. The minimum is 512 bits and the maximum is 16384 bits\&. The default is 2048 bits\&. Any size between the minimum and maximum is allowed\&.
Specify the name of a token to use or act on\&. If not specified the default token is the internal database slot\&.
.RE
.PP
\-i input_file
.RS4
Pass an input file to the command\&. Depending on the command option, an input file can be a specific certificate, a certificate request file, or a batch file of commands\&.
.RE
.PP
\-k key\-type\-or\-id
.RS4
Specify the type or specific ID of a key\&.
.sp
The valid key type options are rsa, dsa, ec, or all\&. The default value is rsa\&. Specifying the type of key can avoid mistakes caused by duplicate nicknames\&. Giving a key type generates a new key pair; giving the ID of an existing key reuses that key pair (which is required to renew certificates)\&.
.RE
.PP
\-l
.RS4
Display detailed information when validating a certificate with the \-V option\&.
.RE
.PP
\-m serial\-number
.RS4
Assign a unique serial number to a certificate being created\&. This operation should be performed by a CA\&. If no serial number is provided a default serial number is made from the current time\&. Serial numbers are limited to integers
.RE
.PP
\-n nickname
.RS4
Specify the nickname of a certificate or key to list, create, add to a database, modify, or validate\&. Bracket the nickname string with quotation marks if it contains spaces\&.
.RE
.PP
\-o output\-file
.RS4
Specify the output file name for new certificates or binary certificate requests\&. Bracket the output\-file string with quotation marks if it contains spaces\&. If this argument is not used the output destination defaults to standard output\&.
.RE
.PP
\-P dbPrefix
.RS4
Specify the prefix used on the certificate and key database file\&. This argument is provided to support legacy servers\&. Most applications do not use a database prefix\&.
.RE
.PP
\-p phone
.RS4
Specify a contact telephone number to include in new certificates or certificate requests\&. Bracket this string with quotation marks if it contains spaces\&.
.RE
.PP
\-q pqgfile or curve\-name
.RS4
Read an alternate PQG value from the specified file when generating DSA key pairs\&. If this argument is not used,
\fBcertutil\fR
generates its own PQG value\&. PQG files are created with a separate DSA utility\&.
.sp
Elliptic curve name is one of the ones from SUITE B: nistp256, nistp384, nistp521
Display a certificate\*(Aqs binary DER encoding when listing information about that certificate with the \-L option\&.
.RE
.PP
\-s subject
.RS4
Identify a particular certificate owner for new certificates or certificate requests\&. Bracket this string with quotation marks if it contains spaces\&. The subject identification format follows RFC #1485\&.
.RE
.PP
\-t trustargs
.RS4
Specify the trust attributes to modify in an existing certificate or to apply to a certificate when creating it or adding it to a database\&. There are three available trust categories for each certificate, expressed in the order
\fISSL, email, object signing\fR
for each trust setting\&. In each category position, use none, any, or all of the attribute codes:
.sp
.RS4
.ien\{\
\h'-04'\(bu\h'+03'\c
.\}
.el\{\
.sp-1
.IP\(bu2.3
.\}
\fBp\fR
\- Valid peer
.RE
.sp
.RS4
.ien\{\
\h'-04'\(bu\h'+03'\c
.\}
.el\{\
.sp-1
.IP\(bu2.3
.\}
\fBP\fR
\- Trusted peer (implies p)
.RE
.sp
.RS4
.ien\{\
\h'-04'\(bu\h'+03'\c
.\}
.el\{\
.sp-1
.IP\(bu2.3
.\}
\fBc\fR
\- Valid CA
.RE
.sp
.RS4
.ien\{\
\h'-04'\(bu\h'+03'\c
.\}
.el\{\
.sp-1
.IP\(bu2.3
.\}
\fBT\fR
\- Trusted CA (implies c)
.RE
.sp
.RS4
.ien\{\
\h'-04'\(bu\h'+03'\c
.\}
.el\{\
.sp-1
.IP\(bu2.3
.\}
\fBC\fR
\- trusted CA for client authentication (ssl server only)
.RE
.sp
.RS4
.ien\{\
\h'-04'\(bu\h'+03'\c
.\}
.el\{\
.sp-1
.IP\(bu2.3
.\}
\fBu\fR
\- user
.RE
.sp
The attribute codes for the categories are separated by commas, and the entire set of attributes enclosed by quotation marks\&. For example:
Set the number of months a new certificate will be valid\&. The validity period begins at the current system time unless an offset is added or subtracted with the
\fB\-w\fR
option\&. If this argument is not used, the default validity period is three months\&.
.RE
.PP
\-w offset\-months
.RS4
Set an offset from the current system time, in months, for the beginning of a certificate\*(Aqs validity period\&. Use when creating the certificate or adding it to a database\&. Express the offset in integers, using a minus sign (\-) to indicate a negative offset\&. If this argument is not used, the validity period begins at the current system time\&. The length of the validity period is set with the \-v argument\&.
.RE
.PP
\-X
.RS4
Force the key and certificate database to open in read\-write mode\&. This is used with the
\fB\-U\fR
and
\fB\-L\fR
command options\&.
.RE
.PP
\-x
.RS4
Use
\fBcertutil\fR
to generate the signature for a certificate being created or added to a database, rather than obtaining a signature from a separate CA\&.
.RE
.PP
\-y exp
.RS4
Set an alternate exponent value to use in generating a new RSA public key for the database, instead of the default value of 65537\&. The available alternate values are 3 and 17\&.
.RE
.PP
\-z noise\-file
.RS4
Read a seed value from the specified file to generate a new private and public key pair\&. This argument makes it possible to use hardware\-generated seed values or manually create a value from the keyboard\&. The minimum file size is 20 bytes\&.
Add a basic constraint extension to a certificate that is being created or added to a database\&. This extension supports the certificate chain verification process\&.
\fBcertutil\fR
prompts for the certificate constraint extension to select\&.
.sp
X\&.509 certificate extensions are described in RFC 5280\&.
.RE
.PP
\-3
.RS4
Add an authority key ID extension to a certificate that is being created or added to a database\&. This extension supports the identification of a particular certificate, from among multiple certificates associated with one subject name, as the correct issuer of a certificate\&. The Certificate Database Tool will prompt you to select the authority key ID extension\&.
.sp
X\&.509 certificate extensions are described in RFC 5280\&.
.RE
.PP
\-4
.RS4
Add a CRL distribution point extension to a certificate that is being created or added to a database\&. This extension identifies the URL of a certificate\*(Aqs associated certificate revocation list (CRL)\&.
\fBcertutil\fR
prompts for the URL\&.
.sp
X\&.509 certificate extensions are described in RFC 5280\&.
X\&.509 certificate extensions are described in RFC 5280\&.
.RE
.PP
\-6 | \-\-extKeyUsage keyword,keyword
.RS4
Add an extended key usage extension to a certificate that is being created or added to the database\&. Several keywords are available:
.sp
.RS4
.ien\{\
\h'-04'\(bu\h'+03'\c
.\}
.el\{\
.sp-1
.IP\(bu2.3
.\}
serverAuth
.RE
.sp
.RS4
.ien\{\
\h'-04'\(bu\h'+03'\c
.\}
.el\{\
.sp-1
.IP\(bu2.3
.\}
clientAuth
.RE
.sp
.RS4
.ien\{\
\h'-04'\(bu\h'+03'\c
.\}
.el\{\
.sp-1
.IP\(bu2.3
.\}
codeSigning
.RE
.sp
.RS4
.ien\{\
\h'-04'\(bu\h'+03'\c
.\}
.el\{\
.sp-1
.IP\(bu2.3
.\}
emailProtection
.RE
.sp
.RS4
.ien\{\
\h'-04'\(bu\h'+03'\c
.\}
.el\{\
.sp-1
.IP\(bu2.3
.\}
timeStamp
.RE
.sp
.RS4
.ien\{\
\h'-04'\(bu\h'+03'\c
.\}
.el\{\
.sp-1
.IP\(bu2.3
.\}
ocspResponder
.RE
.sp
.RS4
.ien\{\
\h'-04'\(bu\h'+03'\c
.\}
.el\{\
.sp-1
.IP\(bu2.3
.\}
stepUp
.RE
.sp
.RS4
.ien\{\
\h'-04'\(bu\h'+03'\c
.\}
.el\{\
.sp-1
.IP\(bu2.3
.\}
msTrustListSign
.RE
.sp
.RS4
.ien\{\
\h'-04'\(bu\h'+03'\c
.\}
.el\{\
.sp-1
.IP\(bu2.3
.\}
critical
.RE
.sp
X\&.509 certificate extensions are described in RFC 5280\&.
.RE
.PP
\-7 emailAddrs
.RS4
Add a comma\-separated list of email addresses to the subject alternative name extension of a certificate or certificate request that is being created or added to the database\&. Subject alternative name extensions are described in Section 4\&.2\&.1\&.7 of RFC 3280\&.
.RE
.PP
\-8 dns\-names
.RS4
Add a comma\-separated list of DNS names to the subject alternative name extension of a certificate or certificate request that is being created or added to the database\&. Subject alternative name extensions are described in Section 4\&.2\&.1\&.7 of RFC 3280\&.
.RE
.PP
\-\-extAIA
.RS4
Add the Authority Information Access extension to the certificate\&. X\&.509 certificate extensions are described in RFC 5280\&.
.RE
.PP
\-\-extSIA
.RS4
Add the Subject Information Access extension to the certificate\&. X\&.509 certificate extensions are described in RFC 5280\&.
.RE
.PP
\-\-extCP
.RS4
Add the Certificate Policies extension to the certificate\&. X\&.509 certificate extensions are described in RFC 5280\&.
.RE
.PP
\-\-extPM
.RS4
Add the Policy Mappings extension to the certificate\&. X\&.509 certificate extensions are described in RFC 5280\&.
.RE
.PP
\-\-extPC
.RS4
Add the Policy Constraints extension to the certificate\&. X\&.509 certificate extensions are described in RFC 5280\&.
.RE
.PP
\-\-extIA
.RS4
Add the Inhibit Any Policy Access extension to the certificate\&. X\&.509 certificate extensions are described in RFC 5280\&.
.RE
.PP
\-\-extSKID
.RS4
Add the Subject Key ID extension to the certificate\&. X\&.509 certificate extensions are described in RFC 5280\&.
.RE
.PP
\-\-extNC
.RS4
Add a Name Constraint extension to the certificate\&. X\&.509 certificate extensions are described in RFC 5280\&.
Use empty password when creating new certificate database with \-N\&.
.RE
.PP
\-\-keyAttrFlags attrflags
.RS4
PKCS #11 key Attributes\&. Comma separated list of key attribute flags, selected from the following list of choices: {token | session} {public | private} {sensitive | insensitive} {modifiable | unmodifiable} {extractable | unextractable}
PKCS #11 key Operation Flags\&. Comma separated list of one or more of the following: {token | session} {public | private} {sensitive | insensitive} {modifiable | unmodifiable} {extractable | unextractable}
Identify the certificate database directory to upgrade\&.
.RE
.PP
\-\-source\-prefix certdir
.RS4
Give the prefix of the certificate and key databases to upgrade\&.
.RE
.PP
\-\-upgrade\-id uniqueID
.RS4
Give the unique ID of the database to upgrade\&.
.RE
.PP
\-\-upgrade\-token\-name name
.RS4
Set the name of the token to use while it is being upgraded\&.
.RE
.PP
\-@ pwfile
.RS4
Give the name of a password file to use for the database being upgraded\&.
.RE
.SH"USAGE AND EXAMPLES"
.PP
Most of the command options in the examples listed here have more arguments available\&. The arguments included in these examples are the most common ones or are used to illustrate a specific scenario\&. Use the
\fB\-H\fR
option to show the complete list of arguments for each command option\&.
.PP
\fBCreating New Security Databases\fR
.PP
Certificates, keys, and security modules related to managing certificates are stored in three related databases:
.sp
.RS4
.ien\{\
\h'-04'\(bu\h'+03'\c
.\}
.el\{\
.sp-1
.IP\(bu2.3
.\}
cert8\&.db or cert9\&.db
.RE
.sp
.RS4
.ien\{\
\h'-04'\(bu\h'+03'\c
.\}
.el\{\
.sp-1
.IP\(bu2.3
.\}
key3\&.db or key4\&.db
.RE
.sp
.RS4
.ien\{\
\h'-04'\(bu\h'+03'\c
.\}
.el\{\
.sp-1
.IP\(bu2.3
.\}
secmod\&.db or pkcs11\&.txt
.RE
.PP
These databases must be created before certificates or keys can be generated\&.
.sp
.ifn\{\
.RS4
.\}
.nf
certutil \-N \-d [sql:]directory
.fi
.ifn\{\
.RE
.\}
.PP
\fBCreating a Certificate Request\fR
.PP
A certificate request contains most or all of the information that is used to generate the final certificate\&. This request is submitted separately to a certificate authority and is then approved by some mechanism (automatically or by human review)\&. Once the request is approved, then the certificate is generated\&.
Generating key\&. This may take a few moments\&.\&.\&.
.fi
.ifn\{\
.RE
.\}
.PP
\fBCreating a Certificate\fR
.PP
A valid certificate must be issued by a trusted CA\&. This can be done by specifying a CA certificate (\fB\-c\fR) that is stored in the certificate database\&. If a CA key pair is not available, you can create a self\-signed certificate using the
\fBGenerating a Certificate from a Certificate Request\fR
.PP
When a certificate request is created, a certificate can be generated by using the request and then referencing a certificate authority signing certificate (the
\fIissuer\fR
specified in the
\fB\-c\fR
argument)\&. The issuing certificate must be in the certificate database in the specified directory\&.
< 1> rsa 40defeeb522ade11090eacebaaf1196a172127df Example Domain Administrator Cert
< 2> rsa 1d0b06f44f6c03842f7d4f4a1dc78b3bcd1b85a5 John Smith user cert
.fi
.ifn\{\
.RE
.\}
.PP
There are ways to narrow the keys listed in the search results:
.sp
.RS4
.ien\{\
\h'-04'\(bu\h'+03'\c
.\}
.el\{\
.sp-1
.IP\(bu2.3
.\}
To return a specific key, use the
\fB\-n\fR\fIname\fR
argument with the name of the key\&.
.RE
.sp
.RS4
.ien\{\
\h'-04'\(bu\h'+03'\c
.\}
.el\{\
.sp-1
.IP\(bu2.3
.\}
If there are multiple security devices loaded, then the
\fB\-h\fR\fItokenname\fR
argument can search a specific token or all tokens\&.
.RE
.sp
.RS4
.ien\{\
\h'-04'\(bu\h'+03'\c
.\}
.el\{\
.sp-1
.IP\(bu2.3
.\}
If there are multiple key types available, then the
\fB\-k\fR\fIkey\-type\fR
argument can search a specific type of key, like RSA, DSA, or ECC\&.
.RE
.PP
\fBListing Security Modules\fR
.PP
The devices that can be used to store certificates \-\- both internal databases and external devices like smart cards \-\- are recognized and used by loading security modules\&. The
\fB\-U\fR
command option lists all of the security modules listed in the
secmod\&.db
database\&. The path to the directory (\fB\-d\fR) is required\&.
.sp
.ifn\{\
.RS4
.\}
.nf
$ certutil \-U \-d sql:/home/my/sharednssdb
slot: NSS User Private Key and Certificate Services
token: NSS Certificate DB
slot: NSS Internal Cryptographic Services
token: NSS Generic Crypto Services
.fi
.ifn\{\
.RE
.\}
.PP
\fBAdding Certificates to the Database\fR
.PP
Existing certificates or certificate requests can be added manually to the certificate database, even if they were generated elsewhere\&. This uses the
A certificate contains an expiration date in itself, and expired certificates are easily rejected\&. However, certificates can also be revoked before they hit their expiration date\&. Checking whether a certificate has been revoked requires validating the certificate\&. Validation can also be used to ensure that the certificate is only used for the purposes it was initially issued for\&. Validation is carried out by the
The trust settings (which relate to the operations that a certificate is allowed to be used for) can be changed after a certificate is created or added to the database\&. This is especially useful for CA certificates, but it can be performed for any type of certificate\&.
$ certutil \-M \-n "My CA Certificate" \-d sql:/home/my/sharednssdb \-t "CTu,CTu,CTu"
.fi
.ifn\{\
.RE
.\}
.PP
\fBPrinting the Certificate Chain\fR
.PP
Certificates can be issued in
\fIchains\fR
because every certificate authority itself has a certificate; when a CA issues a certificate, it essentially stamps that certificate with its own fingerprint\&. The
\fB\-O\fR
prints the full chain of a certificate, going from the initial CA (the root CA) through ever intermediary CA to the actual certificate\&. For example, for an email certificate with two CAs in the chain:
The device which stores certificates \-\- both external hardware devices and internal software databases \-\- can be blanked and reused\&. This operation is performed on the device which stores the data, not directly on the security databases, so the location must be referenced through the token name (\fB\-h\fR) as well as any directory path\&. If there is no external token used, the default value is internal\&.
Many networks have dedicated personnel who handle changes to security tokens (the security officer)\&. This person must supply the password to access the specified token\&. For example:
Many networks or applications may be using older BerkeleyDB versions of the certificate database (cert8\&.db)\&. Databases can be upgraded to the new SQLite version of the database (cert9\&.db) using the
\fB\-\-upgrade\-merge\fR
command option or existing databases can be merged with the new
cert9\&.db
databases using the
\fB\-\-\-merge\fR
command\&.
.PP
The
\fB\-\-upgrade\-merge\fR
command must give information about the original database and then use the standard arguments (like
\fB\-d\fR) to give the information about the new databases\&. The command also requires information that the tool uses for the process to upgrade and write over the original database\&.
.sp
.ifn\{\
.RS4
.\}
.nf
certutil \-\-upgrade\-merge \-d [sql:]directory [\-P dbprefix] \-\-source\-dir directory \-\-source\-prefix dbprefix \-\-upgrade\-id id \-\-upgrade\-token\-name name [\-@ password\-file]
command only requires information about the location of the original database; since it doesn\*(Aqt change the format of the database, it can write over information without performing interim step\&.
A series of commands can be run sequentially from a text file with the
\fB\-B\fR
command option\&. The only argument for this specifies the input file\&.
.sp
.ifn\{\
.RS4
.\}
.nf
$ certutil \-B \-i /path/to/batch\-file
.fi
.ifn\{\
.RE
.\}
.SH"NSS DATABASE TYPES"
.PP
NSS originally used BerkeleyDB databases to store security information\&. The last versions of these
\fIlegacy\fR
databases are:
.sp
.RS4
.ien\{\
\h'-04'\(bu\h'+03'\c
.\}
.el\{\
.sp-1
.IP\(bu2.3
.\}
cert8\&.db for certificates
.RE
.sp
.RS4
.ien\{\
\h'-04'\(bu\h'+03'\c
.\}
.el\{\
.sp-1
.IP\(bu2.3
.\}
key3\&.db for keys
.RE
.sp
.RS4
.ien\{\
\h'-04'\(bu\h'+03'\c
.\}
.el\{\
.sp-1
.IP\(bu2.3
.\}
secmod\&.db for PKCS #11 module information
.RE
.PP
BerkeleyDB has performance limitations, though, which prevent it from being easily used by multiple applications simultaneously\&. NSS has some flexibility that allows applications to use their own, independent database engine while keeping a shared database and working around the access issues\&. Still, NSS requires more flexibility to provide a truly shared security database\&.
.PP
In 2009, NSS introduced a new set of databases that are SQLite databases rather than BerkeleyDB\&. These new databases provide more accessibility and performance:
.sp
.RS4
.ien\{\
\h'-04'\(bu\h'+03'\c
.\}
.el\{\
.sp-1
.IP\(bu2.3
.\}
cert9\&.db for certificates
.RE
.sp
.RS4
.ien\{\
\h'-04'\(bu\h'+03'\c
.\}
.el\{\
.sp-1
.IP\(bu2.3
.\}
key4\&.db for keys
.RE
.sp
.RS4
.ien\{\
\h'-04'\(bu\h'+03'\c
.\}
.el\{\
.sp-1
.IP\(bu2.3
.\}
pkcs11\&.txt, a listing of all of the PKCS #11 modules, contained in a new subdirectory in the security databases directory
.RE
.PP
Because the SQLite databases are designed to be shared, these are the
\fIshared\fR
database type\&. The shared database type is preferred; the legacy format is included for backward compatibility\&.
.PP
By default, the tools (\fBcertutil\fR,
\fBpk12util\fR,
\fBmodutil\fR) assume that the given security databases follow the more common legacy type\&. Using the SQLite databases must be manually specified by using the
\fBsql:\fR
prefix with the given security directory\&. For example:
.sp
.ifn\{\
.RS4
.\}
.nf
$ certutil \-L \-d sql:/home/my/sharednssdb
.fi
.ifn\{\
.RE
.\}
.PP
To set the shared database type as the default type for the tools, set the
\fBNSS_DEFAULT_DB_TYPE\fR
environment variable to
\fBsql\fR:
.sp
.ifn\{\
.RS4
.\}
.nf
export NSS_DEFAULT_DB_TYPE="sql"
.fi
.ifn\{\
.RE
.\}
.PP
This line can be set added to the
~/\&.bashrc
file to make the change permanent\&.
.PP
Most applications do not use the shared database by default, but they can be configured to use them\&. For example, this how\-to article covers how to configure Firefox and Thunderbird to use the new shared NSS databases:
.sp
.RS4
.ien\{\
\h'-04'\(bu\h'+03'\c
.\}
.el\{\
.sp-1
.IP\(bu2.3
.\}
https://wiki\&.mozilla\&.org/NSS_Shared_DB_Howto
.RE
.PP
For an engineering draft on the changes in the shared NSS databases, see the NSS project wiki:
.sp
.RS4
.ien\{\
\h'-04'\(bu\h'+03'\c
.\}
.el\{\
.sp-1
.IP\(bu2.3
.\}
https://wiki\&.mozilla\&.org/NSS_Shared_DB
.RE
.SH"SEE ALSO"
.PP
pk12util (1)
.PP
modutil (1)
.PP
\fBcertutil\fR
has arguments or operations that use features defined in several IETF RFCs\&.
.sp
.RS4
.ien\{\
\h'-04'\(bu\h'+03'\c
.\}
.el\{\
.sp-1
.IP\(bu2.3
.\}
http://tools\&.ietf\&.org/html/rfc5280
.RE
.sp
.RS4
.ien\{\
\h'-04'\(bu\h'+03'\c
.\}
.el\{\
.sp-1
.IP\(bu2.3
.\}
http://tools\&.ietf\&.org/html/rfc1113
.RE
.sp
.RS4
.ien\{\
\h'-04'\(bu\h'+03'\c
.\}
.el\{\
.sp-1
.IP\(bu2.3
.\}
http://tools\&.ietf\&.org/html/rfc1485
.RE
.PP
The NSS wiki has information on the new database design and how to configure applications to use it\&.
.sp
.RS4
.ien\{\
\h'-04'\(bu\h'+03'\c
.\}
.el\{\
.sp-1
.IP\(bu2.3
.\}
https://wiki\&.mozilla\&.org/NSS_Shared_DB_Howto
.RE
.sp
.RS4
.ien\{\
\h'-04'\(bu\h'+03'\c
.\}
.el\{\
.sp-1
.IP\(bu2.3
.\}
https://wiki\&.mozilla\&.org/NSS_Shared_DB
.RE
.SH"ADDITIONAL RESOURCES"
.PP
For information about NSS and other tools related to NSS (like JSS), check out the NSS project wiki at
\m[blue]\fBhttp://www\&.mozilla\&.org/projects/security/pki/nss/\fR\m[]\&. The NSS site relates directly to NSS code changes and releases\&.
Licensed under the Mozilla Public License, v\&. 2\&.0\&. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla\&.org/MPL/2\&.0/\&.