summaryrefslogtreecommitdiff
path: root/security/nss/doc/nroff/certutil.1
blob: b2a8bd2bb86abd651420e46e71d72a0b13c91869 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
'\" t
.\"     Title: CERTUTIL
.\"    Author: [see the "Authors" section]
.\" Generator: DocBook XSL Stylesheets v1.78.1 <http://docbook.sf.net/>
.\"      Date:  8 September 2016
.\"    Manual: NSS Security Tools
.\"    Source: nss-tools
.\"  Language: English
.\"
.TH "CERTUTIL" "1" "8 September 2016" "nss-tools" "NSS Security Tools"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.\" http://bugs.debian.org/507673
.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.ie \n(.g .ds Aq \(aq
.el       .ds Aq '
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
.ad l
.\" -----------------------------------------------------------------
.\" * MAIN CONTENT STARTS HERE *
.\" -----------------------------------------------------------------
.SH "NAME"
certutil \- Manage keys and certificate in both NSS databases and other NSS tokens
.SH "SYNOPSIS"
.HP \w'\fBcertutil\fR\ 'u
\fBcertutil\fR [\fIoptions\fR] [[\fIarguments\fR]]
.SH "STATUS"
.PP
This documentation is still work in progress\&. Please contribute to the initial review in
\m[blue]\fBMozilla NSS bug 836477\fR\m[]\&\s-2\u[1]\d\s+2
.SH "DESCRIPTION"
.PP
The Certificate Database Tool,
\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
.RS 4
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
.RS 4
Run a series of commands from the specified batch file\&. This requires the
\fB\-i\fR
argument\&.
.RE
.PP
\-C
.RS 4
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
.RS 4
Delete a certificate from the certificate database\&.
.RE
.PP
\-\-rename
.RS 4
Change the database nickname of a certificate\&.
.RE
.PP
\-E
.RS 4
Add an email certificate to the certificate database\&.
.RE
.PP
\-F
.RS 4
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
.RS 4
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
.RS 4
Display a list of the command options and arguments\&.
.RE
.PP
\-K
.RS 4
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
.RS 4
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
.RS 4
Modify a certificate\*(Aqs trust attributes using the values of the \-t argument\&.
.RE
.PP
\-N
.RS 4
Create new certificate and key databases\&.
.RE
.PP
\-O
.RS 4
Print the certificate chain\&.
.RE
.PP
\-R
.RS 4
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
.RS 4
Create an individual certificate and add it to a certificate database\&.
.RE
.PP
\-T
.RS 4
Reset the key database or token\&.
.RE
.PP
\-U
.RS 4
List all available modules or print a single named module\&.
.RE
.PP
\-V
.RS 4
Check the validity of a certificate and its attributes\&.
.RE
.PP
\-W
.RS 4
Change the password to a key database\&.
.RE
.PP
\-\-merge
.RS 4
Merge two databases into one\&.
.RE
.PP
\-\-upgrade\-merge
.RS 4
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
.RS 4
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
.RS 4
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
.RS 4
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
.RS 4
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,
key4\&.db, and
pkcs11\&.txt)\&.
.sp
NSS recognizes the following prefixes:
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fBsql:\fR
requests the newer database
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fBdbm:\fR
requests the legacy database
.RE
.sp
If no prefix is specified the default type is retrieved from NSS_DEFAULT_DB_TYPE\&. If NSS_DEFAULT_DB_TYPE is not set then
\fBdbm:\fR
is the default\&.
.RE
.PP
\-\-dump\-ext\-val OID
.RS 4
For single cert, print binary DER encoding of extension OID\&.
.RE
.PP
\-e
.RS 4
Check a certificate\*(Aqs signature during the process of validating a certificate\&.
.RE
.PP
\-\-email email\-address
.RS 4
Specify the email address of a certificate to list\&. Used with the \-L command option\&.
.RE
.PP
\-\-extGeneric OID:critical\-flag:filename[,OID:critical\-flag:filename]\&.\&.\&.
.RS 4
Add one or multiple extensions that certutil cannot encode yet, by loading their encodings from external files\&.
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
OID (example): 1\&.2\&.3\&.4
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
critical\-flag: critical or not\-critical
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
filename: full path to a file containing an encoded extension
.RE
.RE
.PP
\-f password\-file
.RS 4
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\&.
.RE
.PP
\-g keysize
.RS 4
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\&.
.RE
.PP
\-h tokenname
.RS 4
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
.RS 4
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
.RS 4
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
.RS 4
Display detailed information when validating a certificate with the \-V option\&.
.RE
.PP
\-m serial\-number
.RS 4
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
.RS 4
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
.RS 4
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
.RS 4
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
.RS 4
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
.RS 4
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 nistp256, nistp384, nistp521, curve25519.
.sp
If a token is available that supports more curves, the foolowing curves are supported as well: sect163k1, nistk163, sect163r1, sect163r2, nistb163,  sect193r1, sect193r2, sect233k1, nistk233, sect233r1, nistb233, sect239k1, sect283k1, nistk283, sect283r1, nistb283, sect409k1, nistk409, sect409r1, nistb409,  sect571k1, nistk571, sect571r1, nistb571, secp160k1, secp160r1, secp160r2, secp192k1, secp192r1, nistp192,  secp224k1, secp224r1, nistp224, secp256k1, secp256r1, secp384r1, secp521r1, prime192v1, prime192v2, prime192v3, prime239v1, prime239v2, prime239v3, c2pnb163v1, c2pnb163v2, c2pnb163v3, c2pnb176v1, c2tnb191v1, c2tnb191v2, c2tnb191v3, c2pnb208w1, c2tnb239v1, c2tnb239v2, c2tnb239v3, c2pnb272w1, c2pnb304w1, c2tnb359w1, c2pnb368w1, c2tnb431r1, secp112r1, secp112r2, secp128r1, secp128r2, sect113r1, sect113r2, sect131r1, sect131r2
.RE
.PP
\-r
.RS 4
Display a certificate\*(Aqs binary DER encoding when listing information about that certificate with the \-L option\&.
.RE
.PP
\-s subject
.RS 4
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
.RS 4
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
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fBp\fR
\- Valid peer
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fBP\fR
\- Trusted peer (implies p)
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fBc\fR
\- Valid CA
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fBC\fR
\- Trusted CA (implies c)
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fBT\fR
\- trusted CA for client authentication (ssl server only)
.RE
.sp
The attribute codes for the categories are separated by commas, and the entire set of attributes enclosed by quotation marks\&. For example:
.sp
\fB\-t "TC,C,T"\fR
.sp
Use the \-L option to see a list of the current certificates and trust attributes in a certificate database\&.
.sp
Note that the output of the \-L option may include "u" flag, which means that there is a private key associated with the certificate\&. It is a dynamic flag and you cannot set it with certutil\&.
.RE
.PP
\-u certusage
.RS 4
Specify a usage context to apply when validating a certificate with the \-V option\&.
.sp
The contexts are the following:
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fBC\fR
(as an SSL client)
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fBV\fR
(as an SSL server)
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fBL\fR
(as an SSL CA)
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fBA\fR
(as Any CA)
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fBY\fR
(Verify CA)
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fBS\fR
(as an email signer)
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fBR\fR
(as an email recipient)
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fBO\fR
(as an OCSP status responder)
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fBJ\fR
(as an object signer)
.RE
.RE
.PP
\-v valid\-months
.RS 4
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
.RS 4
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
.RS 4
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
.RS 4
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
.RS 4
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
.RS 4
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\&.
.RE
.PP
\-Z hashAlg
.RS 4
Specify the hash algorithm to use with the \-C, \-S or \-R command options\&. Possible keywords:
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
MD2
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
MD4
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
MD5
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
SHA1
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
SHA224
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
SHA256
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
SHA384
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
SHA512
.RE
.RE
.PP
\-0 SSO_password
.RS 4
Set a site security officer password on a token\&.
.RE
.PP
\-1 | \-\-keyUsage keyword,keyword
.RS 4
Set an X\&.509 V3 Certificate Type Extension in the certificate\&. There are several available keywords:
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
digitalSignature
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
nonRepudiation
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
keyEncipherment
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
dataEncipherment
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
keyAgreement
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
certSigning
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
crlSigning
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
critical
.RE
.RE
.PP
\-2
.RS 4
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
.RS 4
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
.RS 4
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\&.
.RE
.PP
\-5 | \-\-nsCertType keyword,keyword
.RS 4
Add an X\&.509 V3 certificate type extension to a certificate that is being created or added to the database\&. There are several available keywords:
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
sslClient
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
sslServer
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
smime
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
objectSigning
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
sslCA
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
smimeCA
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
objectSigningCA
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
critical
.RE
.sp
X\&.509 certificate extensions are described in RFC 5280\&.
.RE
.PP
\-6 | \-\-extKeyUsage keyword,keyword
.RS 4
Add an extended key usage extension to a certificate that is being created or added to the database\&. Several keywords are available:
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
serverAuth
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
clientAuth
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
codeSigning
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
emailProtection
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
timeStamp
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
ocspResponder
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
stepUp
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
msTrustListSign
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
critical
.RE
.sp
X\&.509 certificate extensions are described in RFC 5280\&.
.RE
.PP
\-7 emailAddrs
.RS 4
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
.RS 4
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
.RS 4
Add the Authority Information Access extension to the certificate\&. X\&.509 certificate extensions are described in RFC 5280\&.
.RE
.PP
\-\-extSIA
.RS 4
Add the Subject Information Access extension to the certificate\&. X\&.509 certificate extensions are described in RFC 5280\&.
.RE
.PP
\-\-extCP
.RS 4
Add the Certificate Policies extension to the certificate\&. X\&.509 certificate extensions are described in RFC 5280\&.
.RE
.PP
\-\-extPM
.RS 4
Add the Policy Mappings extension to the certificate\&. X\&.509 certificate extensions are described in RFC 5280\&.
.RE
.PP
\-\-extPC
.RS 4
Add the Policy Constraints extension to the certificate\&. X\&.509 certificate extensions are described in RFC 5280\&.
.RE
.PP
\-\-extIA
.RS 4
Add the Inhibit Any Policy Access extension to the certificate\&. X\&.509 certificate extensions are described in RFC 5280\&.
.RE
.PP
\-\-extSKID
.RS 4
Add the Subject Key ID extension to the certificate\&. X\&.509 certificate extensions are described in RFC 5280\&.
.RE
.PP
\-\-extNC
.RS 4
Add a Name Constraint extension to the certificate\&. X\&.509 certificate extensions are described in RFC 5280\&.
.RE
.PP
\-\-extSAN type:name[,type:name]\&.\&.\&.
.RS 4
Create a Subject Alt Name extension with one or multiple names\&.
.sp
\-type: directory, dn, dns, edi, ediparty, email, ip, ipaddr, other, registerid, rfc822, uri, x400, x400addr
.RE
.PP
\-\-empty\-password
.RS 4
Use empty password when creating new certificate database with \-N\&.
.RE
.PP
\-\-keyAttrFlags attrflags
.RS 4
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}
.RE
.PP
\-\-keyOpFlagsOn opflags, \-\-keyOpFlagsOff opflags
.RS 4
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}
.RE
.PP
\-\-new\-n nickname
.RS 4
A new nickname, used when renaming a certificate\&.
.RE
.PP
\-\-source\-dir certdir
.RS 4
Identify the certificate database directory to upgrade\&.
.RE
.PP
\-\-source\-prefix certdir
.RS 4
Give the prefix of the certificate and key databases to upgrade\&.
.RE
.PP
\-\-upgrade\-id uniqueID
.RS 4
Give the unique ID of the database to upgrade\&.
.RE
.PP
\-\-upgrade\-token\-name name
.RS 4
Set the name of the token to use while it is being upgraded\&.
.RE
.PP
\-@ pwfile
.RS 4
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
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
cert8\&.db or cert9\&.db
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
key3\&.db or key4\&.db
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
secmod\&.db or pkcs11\&.txt
.RE
.PP
These databases must be created before certificates or keys can be generated\&.
.sp
.if n \{\
.RS 4
.\}
.nf
certutil \-N \-d [sql:]directory
.fi
.if n \{\
.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\&.
.sp
.if n \{\
.RS 4
.\}
.nf
$ certutil \-R \-k key\-type\-or\-id [\-q pqgfile|curve\-name] \-g key\-size \-s subject [\-h tokenname] \-d [sql:]directory [\-p phone] [\-o output\-file] [\-a]
.fi
.if n \{\
.RE
.\}
.PP
The
\fB\-R\fR
command options requires four arguments:
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fB\-k\fR
to specify either the key type to generate or, when renewing a certificate, the existing key pair to use
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fB\-g\fR
to set the keysize of the key to generate
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fB\-s\fR
to set the subject name of the certificate
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fB\-d\fR
to give the security database directory
.RE
.PP
The new certificate request can be output in ASCII format (\fB\-a\fR) or can be written to a specified file (\fB\-o\fR)\&.
.PP
For example:
.sp
.if n \{\
.RS 4
.\}
.nf
$ certutil \-R \-k rsa \-g 1024 \-s "CN=John Smith,O=Example Corp,L=Mountain View,ST=California,C=US" \-d sql:$HOME/nssdb \-p 650\-555\-0123 \-a \-o cert\&.cer

Generating key\&.  This may take a few moments\&.\&.\&.

.fi
.if n \{\
.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
\fB\-x\fR
argument with the
\fB\-S\fR
command option\&.
.sp
.if n \{\
.RS 4
.\}
.nf
$ certutil \-S \-k rsa|dsa|ec \-n certname \-s subject [\-c issuer |\-x] \-t trustargs \-d [sql:]directory [\-m serial\-number] [\-v valid\-months] [\-w offset\-months] [\-p phone] [\-1] [\-2] [\-3] [\-4] [\-5 keyword] [\-6 keyword] [\-7 emailAddress] [\-8 dns\-names] [\-\-extAIA] [\-\-extSIA] [\-\-extCP] [\-\-extPM] [\-\-extPC] [\-\-extIA] [\-\-extSKID]
.fi
.if n \{\
.RE
.\}
.PP
The series of numbers and
\fB\-\-ext*\fR
options set certificate extensions that can be added to the certificate when it is generated by the CA\&. Interactive prompts will result\&.
.PP
For example, this creates a self\-signed certificate:
.sp
.if n \{\
.RS 4
.\}
.nf
$ certutil \-S \-s "CN=Example CA" \-n my\-ca\-cert \-x \-t "C,C,C" \-1 \-2 \-5 \-m 3650
.fi
.if n \{\
.RE
.\}
.PP
The interative prompts for key usage and whether any extensions are critical and responses have been ommitted for brevity\&.
.PP
From there, new certificates can reference the self\-signed certificate:
.sp
.if n \{\
.RS 4
.\}
.nf
$ certutil \-S \-s "CN=My Server Cert" \-n my\-server\-cert \-c "my\-ca\-cert" \-t ",," \-1 \-5 \-6 \-8 \-m 730
.fi
.if n \{\
.RE
.\}
.PP
\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\&.
.sp
.if n \{\
.RS 4
.\}
.nf
certutil \-C \-c issuer \-i cert\-request\-file \-o output\-file [\-m serial\-number] [\-v valid\-months] [\-w offset\-months] \-d [sql:]directory [\-1] [\-2] [\-3] [\-4] [\-5 keyword] [\-6 keyword] [\-7 emailAddress] [\-8 dns\-names]
.fi
.if n \{\
.RE
.\}
.PP
For example:
.sp
.if n \{\
.RS 4
.\}
.nf
$ certutil \-C \-c "my\-ca\-cert" \-i /home/certs/cert\&.req \-o cert\&.cer \-m 010 \-v 12 \-w 1 \-d sql:$HOME/nssdb \-1 nonRepudiation,dataEncipherment \-5 sslClient \-6 clientAuth \-7 jsmith@example\&.com
.fi
.if n \{\
.RE
.\}
.PP
\fBListing Certificates\fR
.PP
The
\fB\-L\fR
command option lists all of the certificates listed in the certificate database\&. The path to the directory (\fB\-d\fR) is required\&.
.sp
.if n \{\
.RS 4
.\}
.nf
$ certutil \-L \-d sql:/home/my/sharednssdb

Certificate Nickname                                         Trust Attributes
                                                             SSL,S/MIME,JAR/XPI

CA Administrator of Instance pki\-ca1\*(Aqs Example Domain ID     u,u,u
TPS Administrator\*(Aqs Example Domain ID                        u,u,u
Google Internet Authority                                    ,,   
Certificate Authority \- Example Domain                       CT,C,C
.fi
.if n \{\
.RE
.\}
.PP
Using additional arguments with
\fB\-L\fR
can return and print the information for a single, specific certificate\&. For example, the
\fB\-n\fR
argument passes the certificate name, while the
\fB\-a\fR
argument prints the certificate in ASCII format:
.sp
.if n \{\
.RS 4
.\}
.nf
$ certutil \-L \-d sql:$HOME/nssdb \-a \-n my\-ca\-cert
\-\-\-\-\-BEGIN CERTIFICATE\-\-\-\-\-
MIIB1DCCAT2gAwIBAgICDkIwDQYJKoZIhvcNAQEFBQAwFTETMBEGA1UEAxMKRXhh
bXBsZSBDQTAeFw0xMzAzMTMxOTEwMjlaFw0xMzA2MTMxOTEwMjlaMBUxEzARBgNV
BAMTCkV4YW1wbGUgQ0EwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAJ4Kzqvz
JyBVgFqDXRYSyTBNw1DrxUU/3GvWA/ngjAwHEv0Cul/6sO/gsCvnABHiH6unns6x
XRzPORlC2WY3gkk7vmlsLvYpyecNazAi/NAwVnU/66HOsaoVFWE+gBQo99UrN2yk
0BiK/GMFlLm5dXQROgA9ZKKyFdI0LIXtf6SbAgMBAAGjMzAxMBEGCWCGSAGG+EIB
AQQEAwIHADAMBgNVHRMEBTADAQH/MA4GA1UdDwEB/wQEAwICBDANBgkqhkiG9w0B
AQUFAAOBgQA6chkzkACN281d1jKMrc+RHG2UMaQyxiteaLVZO+Ro1nnRUvseDf09
XKYFwPMJjWCihVku6bw/ihZfuMHhxK22Nue6inNQ6eDu7WmrqL8z3iUrQwxs+WiF
ob2rb8XRVVJkzXdXxlk4uo3UtNvw8sAz7sWD71qxKaIHU5q49zijfg==
\-\-\-\-\-END CERTIFICATE\-\-\-\-\-
.fi
.if n \{\
.RE
.\}
.PP
For a human\-readable display
.sp
.if n \{\
.RS 4
.\}
.nf
$ certutil \-L \-d sql:$HOME/nssdb \-n my\-ca\-cert
Certificate:
    Data:
        Version: 3 (0x2)
        Serial Number: 3650 (0xe42)
        Signature Algorithm: PKCS #1 SHA\-1 With RSA Encryption
        Issuer: "CN=Example CA"
        Validity:
            Not Before: Wed Mar 13 19:10:29 2013
            Not After : Thu Jun 13 19:10:29 2013
        Subject: "CN=Example CA"
        Subject Public Key Info:
            Public Key Algorithm: PKCS #1 RSA Encryption
            RSA Public Key:
                Modulus:
                    9e:0a:ce:ab:f3:27:20:55:80:5a:83:5d:16:12:c9:30:
                    4d:c3:50:eb:c5:45:3f:dc:6b:d6:03:f9:e0:8c:0c:07:
                    12:fd:02:ba:5f:fa:b0:ef:e0:b0:2b:e7:00:11:e2:1f:
                    ab:a7:9e:ce:b1:5d:1c:cf:39:19:42:d9:66:37:82:49:
                    3b:be:69:6c:2e:f6:29:c9:e7:0d:6b:30:22:fc:d0:30:
                    56:75:3f:eb:a1:ce:b1:aa:15:15:61:3e:80:14:28:f7:
                    d5:2b:37:6c:a4:d0:18:8a:fc:63:05:94:b9:b9:75:74:
                    11:3a:00:3d:64:a2:b2:15:d2:34:2c:85:ed:7f:a4:9b
                Exponent: 65537 (0x10001)
        Signed Extensions:
            Name: Certificate Type
            Data: none

            Name: Certificate Basic Constraints
            Data: Is a CA with no maximum path length\&.

            Name: Certificate Key Usage
            Critical: True
            Usages: Certificate Signing

    Signature Algorithm: PKCS #1 SHA\-1 With RSA Encryption
    Signature:
        3a:72:19:33:90:00:8d:db:cd:5d:d6:32:8c:ad:cf:91:
        1c:6d:94:31:a4:32:c6:2b:5e:68:b5:59:3b:e4:68:d6:
        79:d1:52:fb:1e:0d:fd:3d:5c:a6:05:c0:f3:09:8d:60:
        a2:85:59:2e:e9:bc:3f:8a:16:5f:b8:c1:e1:c4:ad:b6:
        36:e7:ba:8a:73:50:e9:e0:ee:ed:69:ab:a8:bf:33:de:
        25:2b:43:0c:6c:f9:68:85:a1:bd:ab:6f:c5:d1:55:52:
        64:cd:77:57:c6:59:38:ba:8d:d4:b4:db:f0:f2:c0:33:
        ee:c5:83:ef:5a:b1:29:a2:07:53:9a:b8:f7:38:a3:7e
    Fingerprint (MD5):
        86:D8:A5:8B:8A:26:BE:9E:17:A8:7B:66:10:6B:27:80
    Fingerprint (SHA1):
        48:78:09:EF:C5:D4:0C:BD:D2:64:45:59:EB:03:13:15:F7:A9:D6:F7

    Certificate Trust Flags:
        SSL Flags:
            Valid CA
            Trusted CA
            User
        Email Flags:
            Valid CA
            Trusted CA
            User
        Object Signing Flags:
            Valid CA
            Trusted CA
            User

.fi
.if n \{\
.RE
.\}
.PP
\fBListing Keys\fR
.PP
Keys are the original material used to encrypt certificate data\&. The keys generated for certificates are stored separately, in the key database\&.
.PP
To list all keys in the database, use the
\fB\-K\fR
command option and the (required)
\fB\-d\fR
argument to give the path to the directory\&.
.sp
.if n \{\
.RS 4
.\}
.nf
$ certutil \-K \-d sql:$HOME/nssdb
certutil: Checking token "NSS Certificate DB" in slot "NSS User Private Key and Certificate Services                  "
< 0> rsa      455a6673bde9375c2887ec8bf8016b3f9f35861d   Thawte Freemail Member\*(Aqs Thawte Consulting (Pty) Ltd\&. ID
< 1> rsa      40defeeb522ade11090eacebaaf1196a172127df   Example Domain Administrator Cert
< 2> rsa      1d0b06f44f6c03842f7d4f4a1dc78b3bcd1b85a5   John Smith user cert
.fi
.if n \{\
.RE
.\}
.PP
There are ways to narrow the keys listed in the search results:
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
To return a specific key, use the
\fB\-n\fR\fIname\fR
argument with the name of the key\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.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
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.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
.if n \{\
.RS 4
.\}
.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
.if n \{\
.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
\fB\-A\fR
command option\&.
.sp
.if n \{\
.RS 4
.\}
.nf
certutil \-A \-n certname \-t trustargs \-d [sql:]directory [\-a] [\-i input\-file]
.fi
.if n \{\
.RE
.\}
.PP
For example:
.sp
.if n \{\
.RS 4
.\}
.nf
$ certutil \-A \-n "CN=My SSL Certificate" \-t ",," \-d sql:/home/my/sharednssdb \-i /home/example\-certs/cert\&.cer
.fi
.if n \{\
.RE
.\}
.PP
A related command option,
\fB\-E\fR, is used specifically to add email certificates to the certificate database\&. The
\fB\-E\fR
command has the same arguments as the
\fB\-A\fR
command\&. The trust arguments for certificates have the format
\fISSL,S/MIME,Code\-signing\fR, so the middle trust settings relate most to email certificates (though the others can be set)\&. For example:
.sp
.if n \{\
.RS 4
.\}
.nf
$ certutil \-E \-n "CN=John Smith Email Cert" \-t ",P," \-d sql:/home/my/sharednssdb \-i /home/example\-certs/email\&.cer
.fi
.if n \{\
.RE
.\}
.PP
\fBDeleting Certificates to the Database\fR
.PP
Certificates can be deleted from a database using the
\fB\-D\fR
option\&. The only required options are to give the security database directory and to identify the certificate nickname\&.
.sp
.if n \{\
.RS 4
.\}
.nf
certutil \-D \-d [sql:]directory \-n "nickname"
.fi
.if n \{\
.RE
.\}
.PP
For example:
.sp
.if n \{\
.RS 4
.\}
.nf
$ certutil \-D \-d sql:/home/my/sharednssdb \-n "my\-ssl\-cert"
.fi
.if n \{\
.RE
.\}
.PP
\fBValidating Certificates\fR
.PP
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
\fB\-V\fR
command option\&.
.sp
.if n \{\
.RS 4
.\}
.nf
certutil \-V \-n certificate\-name [\-b time] [\-e] [\-u cert\-usage] \-d [sql:]directory
.fi
.if n \{\
.RE
.\}
.PP
For example, to validate an email certificate:
.sp
.if n \{\
.RS 4
.\}
.nf
$ certutil \-V \-n "John Smith\*(Aqs Email Cert" \-e \-u S,R \-d sql:/home/my/sharednssdb
.fi
.if n \{\
.RE
.\}
.PP
\fBModifying Certificate Trust Settings\fR
.PP
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\&.
.sp
.if n \{\
.RS 4
.\}
.nf
certutil \-M \-n certificate\-name \-t trust\-args \-d [sql:]directory
.fi
.if n \{\
.RE
.\}
.PP
For example:
.sp
.if n \{\
.RS 4
.\}
.nf
$ certutil \-M \-n "My CA Certificate" \-d sql:/home/my/sharednssdb \-t "CT,CT,CT"
.fi
.if n \{\
.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:
.sp
.if n \{\
.RS 4
.\}
.nf
$ certutil \-d sql:/home/my/sharednssdb \-O \-n "jsmith@example\&.com"
"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]

  "Thawte Personal Freemail Issuing CA \- Thawte Consulting" [CN=Thawte Personal Freemail Issuing CA,O=Thawte Consulting (Pty) Ltd\&.,C=ZA]

    "(null)" [E=jsmith@example\&.com,CN=Thawte Freemail Member]
.fi
.if n \{\
.RE
.\}
.PP
\fBResetting a Token\fR
.PP
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\&.
.sp
.if n \{\
.RS 4
.\}
.nf
certutil \-T \-d [sql:]directory \-h token\-name \-0 security\-officer\-password
.fi
.if n \{\
.RE
.\}
.PP
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:
.sp
.if n \{\
.RS 4
.\}
.nf
$ certutil \-T \-d sql:/home/my/sharednssdb \-h nethsm \-0 secret
.fi
.if n \{\
.RE
.\}
.PP
\fBUpgrading or Merging the Security Databases\fR
.PP
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
.if n \{\
.RS 4
.\}
.nf
certutil \-\-upgrade\-merge \-d [sql:]directory [\-P dbprefix] \-\-source\-dir directory \-\-source\-prefix dbprefix \-\-upgrade\-id id \-\-upgrade\-token\-name name [\-@ password\-file]
.fi
.if n \{\
.RE
.\}
.PP
For example:
.sp
.if n \{\
.RS 4
.\}
.nf
$ certutil \-\-upgrade\-merge \-d sql:/home/my/sharednssdb \-\-source\-dir /opt/my\-app/alias/ \-\-source\-prefix serverapp\- \-\-upgrade\-id 1 \-\-upgrade\-token\-name internal
.fi
.if n \{\
.RE
.\}
.PP
The
\fB\-\-merge\fR
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\&.
.sp
.if n \{\
.RS 4
.\}
.nf
certutil \-\-merge \-d [sql:]directory [\-P dbprefix] \-\-source\-dir directory \-\-source\-prefix dbprefix [\-@ password\-file]
.fi
.if n \{\
.RE
.\}
.PP
For example:
.sp
.if n \{\
.RS 4
.\}
.nf
$ certutil \-\-merge \-d sql:/home/my/sharednssdb \-\-source\-dir /opt/my\-app/alias/ \-\-source\-prefix serverapp\-
.fi
.if n \{\
.RE
.\}
.PP
\fBRunning certutil Commands from a Batch File\fR
.PP
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
.if n \{\
.RS 4
.\}
.nf
$ certutil \-B \-i /path/to/batch\-file
.fi
.if n \{\
.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
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
cert8\&.db for certificates
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
key3\&.db for keys
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.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
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
cert9\&.db for certificates
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
key4\&.db for keys
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.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
.if n \{\
.RS 4
.\}
.nf
$ certutil \-L \-d sql:/home/my/sharednssdb
.fi
.if n \{\
.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
.if n \{\
.RS 4
.\}
.nf
export NSS_DEFAULT_DB_TYPE="sql"
.fi
.if n \{\
.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
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.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
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.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
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
http://tools\&.ietf\&.org/html/rfc5280
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
http://tools\&.ietf\&.org/html/rfc1113
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.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
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
https://wiki\&.mozilla\&.org/NSS_Shared_DB_Howto
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.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\&.
.PP
Mailing lists: https://lists\&.mozilla\&.org/listinfo/dev\-tech\-crypto
.PP
IRC: Freenode at #dogtag\-pki
.SH "AUTHORS"
.PP
The NSS tools were written and maintained by developers with Netscape, Red Hat, Sun, Oracle, Mozilla, and Google\&.
.PP
Authors: Elio Maldonado <emaldona@redhat\&.com>, Deon Lackey <dlackey@redhat\&.com>\&.
.SH "LICENSE"
.PP
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/\&.
.SH "NOTES"
.IP " 1." 4
Mozilla NSS bug 836477
.RS 4
\%https://bugzilla.mozilla.org/show_bug.cgi?id=836477
.RE