Using the Certificate Database Tool
Newsgroup: mozilla.dev.tech.cryptoThe Certificate Database Tool is a command-line utility that can create and modify the Netscape Communicator cert8.db
and key3.db
database files. It can also list, generate, modify, or delete certificates within the cert8.db
file and 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 key3.db
file.
Availability
See the release notes for the platforms this tool is available on.Syntax
To run the Certificate Database Tool, type the commandcertutil
option [arguments]
where options and arguments are combinations of the options and arguments listed in the following section. Each command takes one option. Each option may take zero or more arguments. To see a usage string, issue the command without options, or with the -H
option.
Options and Arguments
Options specify an action and are uppercase. Option arguments modify an action and are lowercase. Certificate Database Tool command options and their arguments are defined as follows:
Usage
The Certificate Database Tool's capabilities are grouped as follows, using these combinations of options and arguments. Options and arguments in square brackets are optional, those without square brackets are required.-
Creating a new
cert8.db
file: - Creating a new certificate and adding it to the database with one command:
- Making a separate certificate request:
- Creating a new binary certificate from a binary certificate request:
- Adding a certificate to an existing database:
- Listing all certificates or a named certificate:
- Validating a certificate:
- Modifying a certificate's trust attribute:
- Displaying a list of the options and arguments used by the Certificate Database Tool:
-N [-d
certdir]
-S -k rsa|dsa -n
certname-s
subjectissuer
[-c|-x] -t
trustargs[-h
tokenname]
serial-number
[-m] [-v
valid-months] [-w
offset-months]
certdir
[-d] [-p
phone] [-f
password-file] [-1] [-2] [-3] [-4]
-R -k rsa|dsa -s
subject[-h
tokenname]
certdir
[-d] [-p
phone] [-o
output-file] [-f
password-file]
-C -c
issuer[-f
password-file]
tokenname
[-h] -i
cert-request-file-o
output-file[-m
serial-number]
valid-months
[-v] [-w
offset-months] [-d
certdir] [-1] [-2] [-3]
[-4]
-A -n
certname-t
trustargs[-h
tokenname] [-d
certdir] [-a]
cert-request-file
[-i]
-L [-n
certname] [-d
certdir] [-r] [-a]
-V -n
certname-b
validity-time-u
certusage[-e] [-l] [-d
certdir]
-M -n
certname-t
trustargs[-d
certdir]
-H
Examples
Creating a New Certificate DatabaseListing Certificates in a Database
Creating a Certificate Request
Creating a Certificate
Adding a Certificate to the Database
Validating a Certificate
Creating a New Certificate Database
This example creates a new certificate database (cert8.db
file) in the specified directory:
certutil -N -d
certdir
You must generate the associated key3.db
and secmod.db
files by using the Key Database Tool or other tools.
Listing Certificates in a Database
This example lists all the certificates in thecert8.db
file in the specified directory:
certutil -L -d
certdir
The Certificate Database Tool displays output similar to the following:
Certificate Name Trust Attributes
Uptime Group Plc. Class 1 CA C,C,
VeriSign Class 1 Primary CA ,C,
VeriSign Class 2 Primary CA C,C,C
AT&T Certificate Services C,C,
GTE CyberTrust Secure Server CA C,,
Verisign/RSA Commercial CA C,C,
AT&T Directory Services C,C,
BelSign Secure Server CA C,,
Verisign/RSA Secure Server CA C,C,
GTE CyberTrust Root CA C,C,
Uptime Group Plc. Class 4 CA ,C,
VeriSign Class 3 Primary CA C,C,C
Canada Post Corporation CA C,C,
Integrion CA C,C,C
IBM World Registry CA C,C,C
GTIS/PWGSC, Canada Gov. Web CA C,C,
GTIS/PWGSC, Canada Gov. Secure CA C,C,C
MCI Mall CA C,C,
VeriSign Class 4 Primary CA C,C,C
KEYWITNESS, Canada CA C,C,
BelSign Object Publishing CA ,,C
BBN Certificate Services CA Root 1 C,C,
p Valid peer
P Trusted peer (implies p)
c Valid CA
T Trusted CA to issue client certs (implies c)
C Trusted CA to issue server certs(for ssl only) (implies c)
u User cert
w Send warning
Creating a Certificate Request
This example generates a binary certificate request file namede95c.req
in the specified directory:
certutil -R -s "CN=John Smith, O=Netscape, L=Mountain View, ST=California, C=US" -p "650-555-8888" -o mycert.req -d
certdir
Before it creates the request file, the Certificate Database Tool prompts you for a password:
Enter Password or Pin for "Communicator Certificate DB":
Creating a Certificate
A valid certificate must be issued by a trusted CA. If a CA key pair is not available, you can create a self-signed certificate (for purposes of illustration) with the-x
argument. This example creates a new binary, self-signed CA certificate named myissuer
, in the specified directory.
certutil -S -s "CN=My Issuer" -n myissuer -x -t "C,C,C" -1 -2 -5 -m 1234
-f
password-file -d
certdir
The following example creates a new binary certificate named mycert.crt
, from a binary certificate request named mycert.req
, in the specified directory. It is issued by the self-signed certificate created above, myissuer
.
certutil -C -m 2345 -i mycert.req -o mycert.crt -c myissuer -d
certdir
Adding a Certificate to the Database
This example adds a certificate to the certificate database:certutil -A -n jsmith@netscape.com -t "p,p,p" -i mycert.crt
-d
certdir
You can see this certificate in the database with this command:
certutil -L -n jsmith@netscape.com -d
certdir
The Certificate Database Tool displays output similar to the following:
Certificate:
Data:
Version: 3 (0x2)
Serial Number: 0 (0x0)
Signature Algorithm: PKCS #1 MD5 With RSA Encryption
Issuer: CN=John Smith, O=Netscape, L=Mountain View, ST=California, C=US
Validity:
Not Before: Thu Mar 12 00:10:40 1998
Not After: Sat Sep 12 00:10:40 1998
Subject: CN=John Smith, O=Netscape, L=Mountain View, ST=California, C=US
Subject Public Key Info:
Public Key Algorithm: PKCS #1 RSA Encryption
RSA Public Key:
Modulus:
00:da:53:23:58:00:91:6a:d1:a2:39:26:2f:06:3a:
38:eb:d4:c1:54:a3:62:00:b9:f0:7f:d6:00:76:aa:
18:da:6b:79:71:5b:d9:8a:82:24:07:ed:49:5b:33:
bf:c5:79:7c:f6:22:a7:18:66:9f:ab:2d:33:03:ec:
63:eb:9d:0d:02:1b:da:32:ae:6c:d4:40:95:9f:b3:
44:8b:8e:8e:a3:ae:ad:08:38:4f:2e:53:e9:e1:3f:
8e:43:7f:51:61:b9:0f:f3:a6:25:1e:0b:93:74:8f:
c6:13:a3:cd:51:40:84:0e:79:ea:b7:6b:d1:cc:6b:
78:d0:5d:da:be:2b:57:c2:6f
Exponent: 65537 (0x10001)
Signature Algorithm: PKCS #1 MD5 With RSA Encryption
Signature:
44:15:e5:ae:c4:30:2c:cd:60:89:f1:1d:22:ed:5e:5b:10:c8:
7e:5f:56:8c:b4:00:12:ed:5f:a4:6a:12:c3:0d:01:03:09:f2:
2f:e7:fd:95:25:47:80:ea:c1:25:5a:33:98:16:52:78:24:80:
c9:53:11:40:99:f5:bd:b8:e9:35:0e:5d:3e:38:6a:5c:10:d1:
c6:f9:54:af:28:56:62:f4:2f:b3:9b:50:e1:c3:a2:ba:27:ee:
07:9f:89:2e:78:5c:6d:46:b6:5e:99:de:e6:9d:eb:d9:ff:b2:
5f:c6:f6:c6:52:4a:d4:67:be:8d:fc:dd:52:51:8e:a2:d7:15:
71:3e
Certificate Trust Flags:
SSL Flags:
Valid CA
Trusted CA
Email Flags:
Valid CA
Trusted CA
Object Signing Flags:
Valid CA
Trusted CA
Validating a Certificate
This example validates a certificate:certutil -V -n jsmith@netscape.com -b 9803201212Z -u SR -e -l
-d
certdir
The Certificate Database Tool shows results similar to
Certificate:'jsmith@netscape.com' is valid.
or
UID=jsmith, E=jsmith@netscape.com, CN=John Smith, O=Netscape Communications Corp., C=US : Expired certificate
or
UID=jsmith, E=jsmith@netscape.com, CN=John Smith, O=Netscape Communications Corp., C=US : Certificate not approved for this operation