security/nss/doc/certutil.xml

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

michael@0 1 <?xml version="1.0" encoding="UTF-8"?>
michael@0 2 <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
michael@0 3 "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" [
michael@0 4 <!ENTITY date SYSTEM "date.xml">
michael@0 5 <!ENTITY version SYSTEM "version.xml">
michael@0 6 ]>
michael@0 7
michael@0 8 <refentry id="certutil">
michael@0 9
michael@0 10 <refentryinfo>
michael@0 11 <date>&date;</date>
michael@0 12 <title>NSS Security Tools</title>
michael@0 13 <productname>nss-tools</productname>
michael@0 14 <productnumber>&version;</productnumber>
michael@0 15 </refentryinfo>
michael@0 16
michael@0 17 <refmeta>
michael@0 18 <refentrytitle>CERTUTIL</refentrytitle>
michael@0 19 <manvolnum>1</manvolnum>
michael@0 20 </refmeta>
michael@0 21
michael@0 22 <refnamediv>
michael@0 23 <refname>certutil</refname>
michael@0 24 <refpurpose>Manage keys and certificate in both NSS databases and other NSS tokens</refpurpose>
michael@0 25 </refnamediv>
michael@0 26
michael@0 27 <refsynopsisdiv>
michael@0 28 <cmdsynopsis>
michael@0 29 <command>certutil</command>
michael@0 30 <arg><replaceable>options</replaceable></arg>
michael@0 31 <arg>[<replaceable>arguments</replaceable>]</arg>
michael@0 32 </cmdsynopsis>
michael@0 33 </refsynopsisdiv>
michael@0 34
michael@0 35 <refsection>
michael@0 36 <title>STATUS</title>
michael@0 37 <para>This documentation is still work in progress. Please contribute to the initial review in <ulink url="https://bugzilla.mozilla.org/show_bug.cgi?id=836477">Mozilla NSS bug 836477</ulink>
michael@0 38 </para>
michael@0 39 </refsection>
michael@0 40
michael@0 41 <refsection id="description">
michael@0 42 <title>Description</title>
michael@0 43
michael@0 44 <para>The Certificate Database Tool, <command>certutil</command>, 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.</para>
michael@0 45 <para>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 <command>modutil</command> manpage.</para>
michael@0 46
michael@0 47 </refsection>
michael@0 48
michael@0 49 <refsection id="options">
michael@0 50 <title>Command Options and Arguments</title>
michael@0 51 <para>Running <command>certutil</command> 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 <option>-H</option> will list all the command options and their relevant arguments.</para>
michael@0 52 <para><command>Command Options</command></para>
michael@0 53 <variablelist>
michael@0 54
michael@0 55 <varlistentry>
michael@0 56 <term>-A </term>
michael@0 57 <listitem><para>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.</para></listitem>
michael@0 58 </varlistentry>
michael@0 59
michael@0 60 <varlistentry>
michael@0 61 <term>-B</term>
michael@0 62 <listitem><para>Run a series of commands from the specified batch file. This requires the <option>-i</option> argument.</para></listitem>
michael@0 63 </varlistentry>
michael@0 64
michael@0 65 <varlistentry>
michael@0 66 <term>-C </term>
michael@0 67 <listitem><para>Create a new binary certificate file from a binary certificate request file. Use the <option>-i</option> argument to specify the certificate request file. If this argument is not used, <command>certutil</command> prompts for a filename. </para></listitem>
michael@0 68 </varlistentry>
michael@0 69
michael@0 70 <varlistentry>
michael@0 71 <term>-D </term>
michael@0 72 <listitem><para>Delete a certificate from the certificate database.</para></listitem>
michael@0 73 </varlistentry>
michael@0 74
michael@0 75 <varlistentry>
michael@0 76 <term>-E </term>
michael@0 77 <listitem><para>Add an email certificate to the certificate database.</para></listitem>
michael@0 78 </varlistentry>
michael@0 79
michael@0 80 <varlistentry>
michael@0 81 <term>-F</term>
michael@0 82 <listitem><para>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
michael@0 83 <option>-d</option> argument. Use the <option>-k</option> argument to specify explicitly whether to delete a DSA, RSA, or ECC key. If you don't use the <option>-k</option> argument, the option looks for an RSA key matching the specified nickname.
michael@0 84 </para>
michael@0 85 <para>
michael@0 86 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. </para></listitem>
michael@0 87 </varlistentry>
michael@0 88
michael@0 89 <varlistentry>
michael@0 90 <term>-G </term>
michael@0 91 <listitem><para>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.</para></listitem>
michael@0 92 </varlistentry>
michael@0 93
michael@0 94 <varlistentry>
michael@0 95 <term>-H </term>
michael@0 96 <listitem><para>Display a list of the command options and arguments.</para></listitem>
michael@0 97 </varlistentry>
michael@0 98
michael@0 99 <varlistentry>
michael@0 100 <term>-K </term>
michael@0 101 <listitem><para>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).</para></listitem>
michael@0 102 </varlistentry>
michael@0 103
michael@0 104 <varlistentry>
michael@0 105 <term>-L </term>
michael@0 106 <listitem><para>List all the certificates, or display information about a named certificate, in a certificate database.
michael@0 107 Use the -h tokenname argument to specify the certificate database on a particular hardware or software token.</para></listitem>
michael@0 108 </varlistentry>
michael@0 109
michael@0 110 <varlistentry>
michael@0 111 <term>-M </term>
michael@0 112 <listitem><para>Modify a certificate's trust attributes using the values of the -t argument.</para></listitem>
michael@0 113 </varlistentry>
michael@0 114
michael@0 115 <varlistentry>
michael@0 116 <term>-N</term>
michael@0 117 <listitem><para>Create new certificate and key databases.</para></listitem>
michael@0 118 </varlistentry>
michael@0 119
michael@0 120 <varlistentry>
michael@0 121 <term>-O </term>
michael@0 122 <listitem><para>Print the certificate chain.</para></listitem>
michael@0 123 </varlistentry>
michael@0 124
michael@0 125 <varlistentry>
michael@0 126 <term>-R</term>
michael@0 127 <listitem><para>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.
michael@0 128
michael@0 129 Use the -a argument to specify ASCII output.</para></listitem>
michael@0 130 </varlistentry>
michael@0 131
michael@0 132 <varlistentry>
michael@0 133 <term>-S </term>
michael@0 134 <listitem><para>Create an individual certificate and add it to a certificate database.</para></listitem>
michael@0 135 </varlistentry>
michael@0 136
michael@0 137 <varlistentry>
michael@0 138 <term>-T </term>
michael@0 139 <listitem><para>Reset the key database or token.</para></listitem>
michael@0 140 </varlistentry>
michael@0 141
michael@0 142 <varlistentry>
michael@0 143 <term>-U </term>
michael@0 144 <listitem><para>List all available modules or print a single named module.</para></listitem>
michael@0 145 </varlistentry>
michael@0 146
michael@0 147 <varlistentry>
michael@0 148 <term>-V </term>
michael@0 149 <listitem><para>Check the validity of a certificate and its attributes.</para></listitem>
michael@0 150 </varlistentry>
michael@0 151
michael@0 152 <varlistentry>
michael@0 153 <term>-W </term>
michael@0 154 <listitem><para>Change the password to a key database.</para></listitem>
michael@0 155 </varlistentry>
michael@0 156
michael@0 157 <varlistentry>
michael@0 158 <term>--merge</term>
michael@0 159 <listitem><para>Merge two databases into one.</para></listitem>
michael@0 160 </varlistentry>
michael@0 161
michael@0 162 <varlistentry>
michael@0 163 <term>--upgrade-merge</term>
michael@0 164 <listitem><para>Upgrade an old database and merge it into a new database. This is used to migrate legacy NSS databases (<filename>cert8.db</filename> and <filename>key3.db</filename>) into the newer SQLite databases (<filename>cert9.db</filename> and <filename>key4.db</filename>).</para></listitem>
michael@0 165 </varlistentry>
michael@0 166 </variablelist>
michael@0 167
michael@0 168 <para><command>Arguments</command></para>
michael@0 169 <para>Arguments modify a command option and are usually lower case, numbers, or symbols.</para>
michael@0 170 <variablelist>
michael@0 171 <varlistentry>
michael@0 172 <term>-a</term>
michael@0 173 <listitem><para>Use ASCII format or allow the use of ASCII format for input or output. This formatting follows RFC 1113.
michael@0 174 For certificate requests, ASCII output defaults to standard output unless redirected.</para></listitem>
michael@0 175 </varlistentry>
michael@0 176
michael@0 177 <varlistentry>
michael@0 178 <term>-b validity-time</term>
michael@0 179 <listitem><para>Specify a time at which a certificate is required to be valid. Use when checking certificate validity with the <option>-V</option> option. The format of the <emphasis>validity-time</emphasis> argument is <emphasis>YYMMDDHHMMSS[+HHMM|-HHMM|Z]</emphasis>, which allows offsets to be set relative to the validity end time. Specifying seconds (<emphasis>SS</emphasis>) is optional. When specifying an explicit time, use a Z at the end of the term, <emphasis>YYMMDDHHMMSSZ</emphasis>, to close it. When specifying an offset time, use <emphasis>YYMMDDHHMMSS+HHMM</emphasis> or <emphasis>YYMMDDHHMMSS-HHMM</emphasis> for adding or subtracting time, respectively.
michael@0 180 </para>
michael@0 181 <para>
michael@0 182 If this option is not used, the validity check defaults to the current system time.</para></listitem>
michael@0 183 </varlistentry>
michael@0 184
michael@0 185 <varlistentry>
michael@0 186 <term>-c issuer</term>
michael@0 187 <listitem><para>Identify the certificate of the CA from which a new certificate will derive its authenticity.
michael@0 188 Use the exact nickname or alias of the CA certificate, or use the CA's email address. Bracket the issuer string
michael@0 189 with quotation marks if it contains spaces. </para></listitem>
michael@0 190 </varlistentry>
michael@0 191
michael@0 192 <varlistentry>
michael@0 193 <term>-d [prefix]directory</term>
michael@0 194 <listitem>
michael@0 195 <para>Specify the database directory containing the certificate and key database files.</para>
michael@0 196 <para><command>certutil</command> supports two types of databases: the legacy security databases (<filename>cert8.db</filename>, <filename>key3.db</filename>, and <filename>secmod.db</filename>) and new SQLite databases (<filename>cert9.db</filename>, <filename>key4.db</filename>, and <filename>pkcs11.txt</filename>). </para>
michael@0 197 <para>NSS recognizes the following prefixes:</para>
michael@0 198 <itemizedlist>
michael@0 199 <listitem><para><command>sql:</command> requests the newer database</para></listitem>
michael@0 200 <listitem><para><command>dbm:</command> requests the legacy database</para></listitem>
michael@0 201 </itemizedlist>
michael@0 202 <para>If no prefix is specified the default type is retrieved from NSS_DEFAULT_DB_TYPE. If NSS_DEFAULT_DB_TYPE is not set then <command>dbm:</command> is the default.</para>
michael@0 203 </listitem>
michael@0 204 </varlistentry>
michael@0 205
michael@0 206 <varlistentry>
michael@0 207 <term>-e </term>
michael@0 208 <listitem><para>Check a certificate's signature during the process of validating a certificate.</para></listitem>
michael@0 209 </varlistentry>
michael@0 210
michael@0 211 <varlistentry>
michael@0 212 <term>--email email-address</term>
michael@0 213 <listitem><para>Specify the email address of a certificate to list. Used with the -L command option.</para></listitem>
michael@0 214 </varlistentry>
michael@0 215
michael@0 216 <varlistentry>
michael@0 217 <term>-f password-file</term>
michael@0 218 <listitem><para>Specify a file that will automatically supply the password to include in a certificate
michael@0 219 or to access a certificate database. This is a plain-text file containing one password. Be sure to prevent
michael@0 220 unauthorized access to this file.</para></listitem>
michael@0 221 </varlistentry>
michael@0 222
michael@0 223 <varlistentry>
michael@0 224 <term>-g keysize</term>
michael@0 225 <listitem><para>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 1024 bits. Any size between the minimum and maximum is allowed.</para></listitem>
michael@0 226 </varlistentry>
michael@0 227
michael@0 228
michael@0 229 <varlistentry>
michael@0 230 <term>-h tokenname</term>
michael@0 231 <listitem><para>Specify the name of a token to use or act on. If not specified the default token is the internal database slot.</para></listitem>
michael@0 232 </varlistentry>
michael@0 233
michael@0 234 <varlistentry>
michael@0 235 <term>-i input_file</term>
michael@0 236 <listitem><para>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.</para></listitem>
michael@0 237 </varlistentry>
michael@0 238
michael@0 239 <varlistentry>
michael@0 240 <term>-k key-type-or-id</term>
michael@0 241 <listitem>
michael@0 242 <para>Specify the type or specific ID of a key.</para>
michael@0 243 <para>
michael@0 244 The valid key type options are rsa, dsa, ec, or all. The default
michael@0 245 value is rsa. Specifying the type of key can avoid mistakes caused by
michael@0 246 duplicate nicknames. Giving a key type generates a new key pair;
michael@0 247 giving the ID of an existing key reuses that key pair (which is
michael@0 248 required to renew certificates).
michael@0 249 </para>
michael@0 250 </listitem>
michael@0 251 </varlistentry>
michael@0 252
michael@0 253 <varlistentry>
michael@0 254 <term>-l </term>
michael@0 255 <listitem><para>Display detailed information when validating a certificate with the -V option.</para></listitem>
michael@0 256 </varlistentry>
michael@0 257
michael@0 258 <varlistentry>
michael@0 259 <term>-m serial-number</term>
michael@0 260 <listitem><para>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 </para></listitem>
michael@0 261 </varlistentry>
michael@0 262
michael@0 263 <varlistentry>
michael@0 264 <term>-n nickname</term>
michael@0 265 <listitem><para>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.</para></listitem>
michael@0 266 </varlistentry>
michael@0 267
michael@0 268 <varlistentry>
michael@0 269 <term>-o output-file</term>
michael@0 270 <listitem><para>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.</para></listitem>
michael@0 271 </varlistentry>
michael@0 272
michael@0 273 <varlistentry>
michael@0 274 <term>-P dbPrefix</term>
michael@0 275 <listitem><para>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.</para></listitem>
michael@0 276 </varlistentry>
michael@0 277
michael@0 278 <varlistentry>
michael@0 279 <term>-p phone</term>
michael@0 280 <listitem><para>Specify a contact telephone number to include in new certificates or certificate requests. Bracket this string with quotation marks if it contains spaces.</para></listitem>
michael@0 281 </varlistentry>
michael@0 282
michael@0 283 <varlistentry>
michael@0 284 <term>-q pqgfile or curve-name</term>
michael@0 285 <listitem>
michael@0 286 <para>Read an alternate PQG value from the specified file when generating DSA key pairs. If this argument is not used, <command>certutil</command> generates its own PQG value. PQG files are created with a separate DSA utility.</para>
michael@0 287 <para>Elliptic curve name is one of the ones from SUITE B: nistp256, nistp384, nistp521</para>
michael@0 288 <para>
michael@0 289 If NSS has been compiled with support curves outside of SUITE B:
michael@0 290 sect163k1, nistk163, sect163r1, sect163r2,
michael@0 291 nistb163, sect193r1, sect193r2, sect233k1, nistk233,
michael@0 292 sect233r1, nistb233, sect239k1, sect283k1, nistk283,
michael@0 293 sect283r1, nistb283, sect409k1, nistk409, sect409r1,
michael@0 294 nistb409, sect571k1, nistk571, sect571r1, nistb571,
michael@0 295 secp160k1, secp160r1, secp160r2, secp192k1, secp192r1,
michael@0 296 nistp192, secp224k1, secp224r1, nistp224, secp256k1,
michael@0 297 secp256r1, secp384r1, secp521r1,
michael@0 298 prime192v1, prime192v2, prime192v3,
michael@0 299 prime239v1, prime239v2, prime239v3, c2pnb163v1,
michael@0 300 c2pnb163v2, c2pnb163v3, c2pnb176v1, c2tnb191v1,
michael@0 301 c2tnb191v2, c2tnb191v3,
michael@0 302 c2pnb208w1, c2tnb239v1, c2tnb239v2, c2tnb239v3,
michael@0 303 c2pnb272w1, c2pnb304w1,
michael@0 304 c2tnb359w1, c2pnb368w1, c2tnb431r1, secp112r1,
michael@0 305 secp112r2, secp128r1, secp128r2, sect113r1, sect113r2
michael@0 306 sect131r1, sect131r2
michael@0 307 </para>
michael@0 308
michael@0 309 </listitem>
michael@0 310
michael@0 311 </varlistentry>
michael@0 312
michael@0 313 <varlistentry>
michael@0 314 <term>-r </term>
michael@0 315 <listitem><para>Display a certificate's binary DER encoding when listing information about that certificate with the -L option.</para></listitem>
michael@0 316 </varlistentry>
michael@0 317
michael@0 318 <varlistentry>
michael@0 319 <term>-s subject</term>
michael@0 320 <listitem><para>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.</para></listitem>
michael@0 321 </varlistentry>
michael@0 322
michael@0 323 <varlistentry>
michael@0 324 <term>-t trustargs</term>
michael@0 325 <listitem><para>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 <emphasis>SSL, email, object signing</emphasis> for each trust setting. In each category position, use none, any, or all
michael@0 326 of the attribute codes:
michael@0 327 </para>
michael@0 328 <itemizedlist>
michael@0 329 <listitem>
michael@0 330 <para>
michael@0 331 <command>p</command> - Valid peer
michael@0 332 </para>
michael@0 333 </listitem>
michael@0 334 <listitem>
michael@0 335 <para>
michael@0 336 <command>P</command> - Trusted peer (implies p)
michael@0 337 </para>
michael@0 338 </listitem>
michael@0 339 <listitem>
michael@0 340 <para>
michael@0 341 <command>c</command> - Valid CA
michael@0 342 </para>
michael@0 343 </listitem>
michael@0 344 <listitem>
michael@0 345 <para>
michael@0 346 <command>T</command> - Trusted CA (implies c)
michael@0 347 </para>
michael@0 348 </listitem>
michael@0 349 <listitem>
michael@0 350 <para>
michael@0 351 <command>C</command> - trusted CA for client authentication (ssl server only)
michael@0 352 </para>
michael@0 353 </listitem>
michael@0 354 <listitem>
michael@0 355 <para>
michael@0 356 <command>u</command> - user
michael@0 357 </para>
michael@0 358 </listitem>
michael@0 359 </itemizedlist>
michael@0 360 <para>
michael@0 361 The attribute codes for the categories are separated by commas, and the entire set of attributes enclosed by quotation marks. For example:
michael@0 362 </para>
michael@0 363 <para><command>-t "TCu,Cu,Tu"</command></para>
michael@0 364 <para>
michael@0 365 Use the -L option to see a list of the current certificates and trust attributes in a certificate database. </para></listitem>
michael@0 366 </varlistentry>
michael@0 367
michael@0 368 <varlistentry>
michael@0 369 <term>-u certusage</term>
michael@0 370 <listitem><para>Specify a usage context to apply when validating a certificate with the -V option.</para><para>The contexts are the following:</para>
michael@0 371 <itemizedlist>
michael@0 372 <listitem>
michael@0 373 <para><command>C</command> (as an SSL client)</para>
michael@0 374 </listitem>
michael@0 375 <listitem>
michael@0 376 <para><command>V</command> (as an SSL server)</para>
michael@0 377 </listitem>
michael@0 378 <listitem>
michael@0 379 <para><command>S</command> (as an email signer)</para>
michael@0 380 </listitem>
michael@0 381 <listitem>
michael@0 382 <para><command>R</command> (as an email recipient)</para>
michael@0 383 </listitem>
michael@0 384 <listitem>
michael@0 385 <para><command>O</command> (as an OCSP status responder)</para>
michael@0 386 </listitem>
michael@0 387 <listitem>
michael@0 388 <para><command>J</command> (as an object signer)</para>
michael@0 389 </listitem>
michael@0 390 </itemizedlist></listitem>
michael@0 391 </varlistentry>
michael@0 392
michael@0 393 <varlistentry>
michael@0 394 <term>-v valid-months</term>
michael@0 395 <listitem><para>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 <option>-w</option> option. If this argument is not used, the default validity period is three months. </para></listitem>
michael@0 396 </varlistentry>
michael@0 397
michael@0 398 <varlistentry>
michael@0 399 <term>-w offset-months</term>
michael@0 400 <listitem><para>Set an offset from the current system time, in months,
michael@0 401 for the beginning of a certificate's validity period. Use when creating
michael@0 402 the certificate or adding it to a database. Express the offset in integers,
michael@0 403 using a minus sign (-) to indicate a negative offset. If this argument is
michael@0 404 not used, the validity period begins at the current system time. The length
michael@0 405 of the validity period is set with the -v argument. </para></listitem>
michael@0 406 </varlistentry>
michael@0 407
michael@0 408 <varlistentry>
michael@0 409 <term>-X </term>
michael@0 410 <listitem><para>Force the key and certificate database to open in read-write mode. This is used with the <option>-U</option> and <option>-L</option> command options.</para></listitem>
michael@0 411 </varlistentry>
michael@0 412
michael@0 413 <varlistentry>
michael@0 414 <term>-x </term>
michael@0 415 <listitem><para>Use <command>certutil</command> to generate the signature for a certificate being created or added to a database, rather than obtaining a signature from a separate CA.</para></listitem>
michael@0 416 </varlistentry>
michael@0 417
michael@0 418 <varlistentry>
michael@0 419 <term>-y exp</term>
michael@0 420 <listitem><para>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.</para></listitem>
michael@0 421 </varlistentry>
michael@0 422
michael@0 423 <varlistentry>
michael@0 424 <term>-z noise-file</term>
michael@0 425 <listitem><para>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.</para></listitem>
michael@0 426 </varlistentry>
michael@0 427
michael@0 428 <varlistentry>
michael@0 429 <term>-0 SSO_password</term>
michael@0 430 <listitem><para>Set a site security officer password on a token.</para></listitem>
michael@0 431 </varlistentry>
michael@0 432
michael@0 433 <varlistentry>
michael@0 434 <term>-1 | --keyUsage keyword,keyword</term>
michael@0 435 <listitem><para>Set an X.509 V3 Certificate Type Extension in the certificate. There are several available keywords:</para>
michael@0 436 <itemizedlist>
michael@0 437 <listitem>
michael@0 438 <para>
michael@0 439 digitalSignature
michael@0 440 </para>
michael@0 441 </listitem>
michael@0 442 <listitem>
michael@0 443 <para>
michael@0 444 nonRepudiation
michael@0 445 </para>
michael@0 446 </listitem>
michael@0 447 <listitem>
michael@0 448 <para>
michael@0 449 keyEncipherment
michael@0 450 </para>
michael@0 451 </listitem>
michael@0 452 <listitem>
michael@0 453 <para>
michael@0 454 dataEncipherment
michael@0 455 </para>
michael@0 456 </listitem>
michael@0 457 <listitem>
michael@0 458 <para>
michael@0 459 keyAgreement
michael@0 460 </para>
michael@0 461 </listitem>
michael@0 462 <listitem>
michael@0 463 <para>
michael@0 464 certSigning
michael@0 465 </para>
michael@0 466 </listitem>
michael@0 467 <listitem>
michael@0 468 <para>
michael@0 469 crlSigning
michael@0 470 </para>
michael@0 471 </listitem>
michael@0 472 <listitem>
michael@0 473 <para>
michael@0 474 critical
michael@0 475 </para>
michael@0 476 </listitem>
michael@0 477 </itemizedlist>
michael@0 478 </listitem>
michael@0 479 </varlistentry>
michael@0 480
michael@0 481 <varlistentry>
michael@0 482 <term>-2 </term>
michael@0 483 <listitem><para>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. <command>certutil</command> prompts for the certificate constraint extension to select.</para>
michael@0 484 <para>X.509 certificate extensions are described in RFC 5280.</para></listitem>
michael@0 485 </varlistentry>
michael@0 486
michael@0 487 <varlistentry>
michael@0 488 <term>-3 </term>
michael@0 489 <listitem><para>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.</para>
michael@0 490 <para>X.509 certificate extensions are described in RFC 5280.</para></listitem>
michael@0 491 </varlistentry>
michael@0 492
michael@0 493 <varlistentry>
michael@0 494 <term>-4 </term>
michael@0 495 <listitem><para>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's associated certificate revocation list (CRL). <command>certutil</command> prompts for the URL.</para>
michael@0 496 <para>X.509 certificate extensions are described in RFC 5280.</para></listitem>
michael@0 497 </varlistentry>
michael@0 498
michael@0 499 <varlistentry>
michael@0 500 <term>-5 | --nsCertType keyword,keyword</term>
michael@0 501 <listitem><para>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:</para>
michael@0 502 <itemizedlist>
michael@0 503 <listitem>
michael@0 504 <para>
michael@0 505 sslClient
michael@0 506 </para>
michael@0 507 </listitem>
michael@0 508 <listitem>
michael@0 509 <para>
michael@0 510 sslServer
michael@0 511 </para>
michael@0 512 </listitem>
michael@0 513 <listitem>
michael@0 514 <para>
michael@0 515 smime
michael@0 516 </para>
michael@0 517 </listitem>
michael@0 518 <listitem>
michael@0 519 <para>
michael@0 520 objectSigning
michael@0 521 </para>
michael@0 522 </listitem>
michael@0 523 <listitem>
michael@0 524 <para>
michael@0 525 sslCA
michael@0 526 </para>
michael@0 527 </listitem>
michael@0 528 <listitem>
michael@0 529 <para>
michael@0 530 smimeCA
michael@0 531 </para>
michael@0 532 </listitem>
michael@0 533 <listitem>
michael@0 534 <para>
michael@0 535 objectSigningCA
michael@0 536 </para>
michael@0 537 </listitem>
michael@0 538 <listitem>
michael@0 539 <para>
michael@0 540 critical
michael@0 541 </para>
michael@0 542 </listitem>
michael@0 543 </itemizedlist>
michael@0 544
michael@0 545 <para>X.509 certificate extensions are described in RFC 5280.</para></listitem>
michael@0 546 </varlistentry>
michael@0 547
michael@0 548 <varlistentry>
michael@0 549 <term>-6 | --extKeyUsage keyword,keyword</term>
michael@0 550 <listitem><para>Add an extended key usage extension to a certificate that is being created or added to the database. Several keywords are available:</para>
michael@0 551 <itemizedlist>
michael@0 552 <listitem>
michael@0 553 <para>
michael@0 554 serverAuth
michael@0 555 </para>
michael@0 556 </listitem>
michael@0 557 <listitem>
michael@0 558 <para>
michael@0 559 clientAuth
michael@0 560 </para>
michael@0 561 </listitem>
michael@0 562 <listitem>
michael@0 563 <para>
michael@0 564 codeSigning
michael@0 565 </para>
michael@0 566 </listitem>
michael@0 567 <listitem>
michael@0 568 <para>
michael@0 569 emailProtection
michael@0 570 </para>
michael@0 571 </listitem>
michael@0 572 <listitem>
michael@0 573 <para>
michael@0 574 timeStamp
michael@0 575 </para>
michael@0 576 </listitem>
michael@0 577 <listitem>
michael@0 578 <para>
michael@0 579 ocspResponder
michael@0 580 </para>
michael@0 581 </listitem>
michael@0 582 <listitem>
michael@0 583 <para>
michael@0 584 stepUp
michael@0 585 </para>
michael@0 586 </listitem>
michael@0 587 <listitem>
michael@0 588 <para>
michael@0 589 msTrustListSign
michael@0 590 </para>
michael@0 591 </listitem>
michael@0 592 <listitem>
michael@0 593 <para>
michael@0 594 critical
michael@0 595 </para>
michael@0 596 </listitem>
michael@0 597 </itemizedlist>
michael@0 598 <para>X.509 certificate extensions are described in RFC 5280.</para></listitem>
michael@0 599 </varlistentry>
michael@0 600
michael@0 601 <varlistentry>
michael@0 602 <term>-7 emailAddrs</term>
michael@0 603 <listitem><para>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.</para></listitem>
michael@0 604 </varlistentry>
michael@0 605
michael@0 606 <varlistentry>
michael@0 607 <term>-8 dns-names</term>
michael@0 608 <listitem><para>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.</para></listitem>
michael@0 609 </varlistentry>
michael@0 610
michael@0 611 <varlistentry>
michael@0 612 <term>--extAIA</term>
michael@0 613 <listitem><para>Add the Authority Information Access extension to the certificate. X.509 certificate extensions are described in RFC 5280.</para></listitem>
michael@0 614 </varlistentry>
michael@0 615
michael@0 616 <varlistentry>
michael@0 617 <term>--extSIA</term>
michael@0 618 <listitem><para>Add the Subject Information Access extension to the certificate. X.509 certificate extensions are described in RFC 5280.</para></listitem>
michael@0 619 </varlistentry>
michael@0 620
michael@0 621 <varlistentry>
michael@0 622 <term>--extCP</term>
michael@0 623 <listitem><para>Add the Certificate Policies extension to the certificate. X.509 certificate extensions are described in RFC 5280.</para></listitem>
michael@0 624 </varlistentry>
michael@0 625
michael@0 626 <varlistentry>
michael@0 627 <term>--extPM</term>
michael@0 628 <listitem><para>Add the Policy Mappings extension to the certificate. X.509 certificate extensions are described in RFC 5280.</para></listitem>
michael@0 629 </varlistentry>
michael@0 630
michael@0 631 <varlistentry>
michael@0 632 <term>--extPC</term>
michael@0 633 <listitem><para>Add the Policy Constraints extension to the certificate. X.509 certificate extensions are described in RFC 5280.</para></listitem>
michael@0 634 </varlistentry>
michael@0 635
michael@0 636 <varlistentry>
michael@0 637 <term>--extIA</term>
michael@0 638 <listitem><para>Add the Inhibit Any Policy Access extension to the certificate. X.509 certificate extensions are described in RFC 5280.</para></listitem>
michael@0 639 </varlistentry>
michael@0 640
michael@0 641 <varlistentry>
michael@0 642 <term>--extSKID</term>
michael@0 643 <listitem><para>Add the Subject Key ID extension to the certificate. X.509 certificate extensions are described in RFC 5280.</para></listitem>
michael@0 644 </varlistentry>
michael@0 645
michael@0 646 <varlistentry>
michael@0 647 <term>--extNC</term>
michael@0 648 <listitem><para>Add a Name Constraint extension to the certificate. X.509 certificate extensions are described in RFC 5280.</para></listitem>
michael@0 649 </varlistentry>
michael@0 650
michael@0 651 <varlistentry>
michael@0 652 <term>--empty-password</term>
michael@0 653 <listitem><para>Use empty password when creating new certificate database with -N.</para></listitem>
michael@0 654 </varlistentry>
michael@0 655
michael@0 656 <varlistentry>
michael@0 657 <term>--keyAttrFlags attrflags</term>
michael@0 658 <listitem><para>
michael@0 659 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}</para></listitem>
michael@0 660 </varlistentry>
michael@0 661
michael@0 662 <varlistentry>
michael@0 663 <term>--keyOpFlagsOn opflags</term>
michael@0 664 <term>--keyOpFlagsOff opflags</term>
michael@0 665 <listitem><para>
michael@0 666 PKCS #11 key Operation Flags.
michael@0 667 Comma separated list of one or more of the following:
michael@0 668 {token | session} {public | private} {sensitive | insensitive} {modifiable | unmodifiable} {extractable | unextractable}
michael@0 669 </para></listitem>
michael@0 670 </varlistentry>
michael@0 671
michael@0 672 <varlistentry>
michael@0 673 <term>--source-dir certdir</term>
michael@0 674 <listitem><para>Identify the certificate database directory to upgrade.</para></listitem>
michael@0 675 </varlistentry>
michael@0 676
michael@0 677 <varlistentry>
michael@0 678 <term>--source-prefix certdir</term>
michael@0 679 <listitem><para>Give the prefix of the certificate and key databases to upgrade.</para></listitem>
michael@0 680 </varlistentry>
michael@0 681
michael@0 682 <varlistentry>
michael@0 683 <term>--upgrade-id uniqueID</term>
michael@0 684 <listitem><para>Give the unique ID of the database to upgrade.</para></listitem>
michael@0 685 </varlistentry>
michael@0 686
michael@0 687 <varlistentry>
michael@0 688 <term>--upgrade-token-name name</term>
michael@0 689 <listitem><para>Set the name of the token to use while it is being upgraded.</para></listitem>
michael@0 690 </varlistentry>
michael@0 691
michael@0 692 <varlistentry>
michael@0 693 <term>-@ pwfile</term>
michael@0 694 <listitem><para>Give the name of a password file to use for the database being upgraded.</para></listitem>
michael@0 695 </varlistentry>
michael@0 696
michael@0 697 </variablelist>
michael@0 698 </refsection>
michael@0 699
michael@0 700 <refsection id="basic-usage">
michael@0 701 <title>Usage and Examples</title>
michael@0 702 <para>
michael@0 703 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 <option>-H</option> option to show the complete list of arguments for each command option.
michael@0 704 </para>
michael@0 705 <para><command>Creating New Security Databases</command></para>
michael@0 706 <para>
michael@0 707 Certificates, keys, and security modules related to managing certificates are stored in three related databases:
michael@0 708 </para>
michael@0 709 <itemizedlist>
michael@0 710 <listitem>
michael@0 711 <para>
michael@0 712 cert8.db or cert9.db
michael@0 713 </para>
michael@0 714 </listitem>
michael@0 715 <listitem>
michael@0 716 <para>
michael@0 717 key3.db or key4.db
michael@0 718 </para>
michael@0 719 </listitem>
michael@0 720 <listitem>
michael@0 721 <para>
michael@0 722 secmod.db or pkcs11.txt
michael@0 723 </para>
michael@0 724 </listitem>
michael@0 725 </itemizedlist>
michael@0 726 <para>
michael@0 727 These databases must be created before certificates or keys can be generated.
michael@0 728 </para>
michael@0 729 <programlisting>certutil -N -d [sql:]directory</programlisting>
michael@0 730
michael@0 731 <para><command>Creating a Certificate Request</command></para>
michael@0 732 <para>
michael@0 733 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.
michael@0 734 </para>
michael@0 735 <programlisting>$ 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]</programlisting>
michael@0 736 <para>
michael@0 737 The <option>-R</option> command options requires four arguments:
michael@0 738 </para>
michael@0 739 <itemizedlist>
michael@0 740 <listitem>
michael@0 741 <para>
michael@0 742 <option>-k</option> to specify either the key type to generate or, when renewing a certificate, the existing key pair to use
michael@0 743 </para>
michael@0 744 </listitem>
michael@0 745 <listitem>
michael@0 746 <para>
michael@0 747 <option>-g</option> to set the keysize of the key to generate
michael@0 748 </para>
michael@0 749 </listitem>
michael@0 750 <listitem>
michael@0 751 <para>
michael@0 752 <option>-s</option> to set the subject name of the certificate
michael@0 753 </para>
michael@0 754 </listitem>
michael@0 755 <listitem>
michael@0 756 <para>
michael@0 757 <option>-d</option> to give the security database directory
michael@0 758 </para>
michael@0 759 </listitem>
michael@0 760 </itemizedlist>
michael@0 761 <para>
michael@0 762 The new certificate request can be output in ASCII format (<option>-a</option>) or can be written to a specified file (<option>-o</option>).
michael@0 763 </para>
michael@0 764 <para>
michael@0 765 For example:
michael@0 766 </para>
michael@0 767 <programlisting>$ 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
michael@0 768
michael@0 769 Generating key. This may take a few moments...
michael@0 770
michael@0 771 </programlisting>
michael@0 772
michael@0 773 <para><command>Creating a Certificate</command></para>
michael@0 774 <para>
michael@0 775 A valid certificate must be issued by a trusted CA. This can be done by specifying a CA certificate (<option>-c</option>) that is stored in the certificate database. If a CA key pair is not available, you can create a self-signed certificate using the <option>-x</option> argument with the <option>-S</option> command option.
michael@0 776 </para>
michael@0 777 <programlisting>$ 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]</programlisting>
michael@0 778 <para>
michael@0 779 The series of numbers and <option>--ext*</option> options set certificate extensions that can be added to the certificate when it is generated by the CA. Interactive prompts will result.
michael@0 780 </para>
michael@0 781 <para>
michael@0 782 For example, this creates a self-signed certificate:
michael@0 783 </para>
michael@0 784 <programlisting>$ certutil -S -s "CN=Example CA" -n my-ca-cert -x -t "C,C,C" -1 -2 -5 -m 3650</programlisting>
michael@0 785 <para>
michael@0 786 The interative prompts for key usage and whether any extensions are critical and responses have been ommitted for brevity.
michael@0 787 </para>
michael@0 788 <para>
michael@0 789 From there, new certificates can reference the self-signed certificate:
michael@0 790 </para>
michael@0 791 <programlisting>$ certutil -S -s "CN=My Server Cert" -n my-server-cert -c "my-ca-cert" -t "u,u,u" -1 -5 -6 -8 -m 730</programlisting>
michael@0 792
michael@0 793 <para><command>Generating a Certificate from a Certificate Request</command></para>
michael@0 794 <para>
michael@0 795 When a certificate request is created, a certificate can be generated by using the request and then referencing a certificate authority signing certificate (the <emphasis>issuer</emphasis> specified in the <option>-c</option> argument). The issuing certificate must be in the certificate database in the specified directory.
michael@0 796 </para>
michael@0 797 <programlisting>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]</programlisting>
michael@0 798 <para>
michael@0 799 For example:
michael@0 800 </para>
michael@0 801 <programlisting>$ 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</programlisting>
michael@0 802
michael@0 803 <para><command>Listing Certificates</command></para>
michael@0 804 <para>
michael@0 805 The <option>-L</option> command option lists all of the certificates listed in the certificate database. The path to the directory (<option>-d</option>) is required.
michael@0 806 </para>
michael@0 807 <programlisting>$ certutil -L -d sql:/home/my/sharednssdb
michael@0 808
michael@0 809 Certificate Nickname Trust Attributes
michael@0 810 SSL,S/MIME,JAR/XPI
michael@0 811
michael@0 812 CA Administrator of Instance pki-ca1's Example Domain ID u,u,u
michael@0 813 TPS Administrator's Example Domain ID u,u,u
michael@0 814 Google Internet Authority ,,
michael@0 815 Certificate Authority - Example Domain CT,C,C</programlisting>
michael@0 816 <para>
michael@0 817 Using additional arguments with <option>-L</option> can return and print the information for a single, specific certificate. For example, the <option>-n</option> argument passes the certificate name, while the <option>-a</option> argument prints the certificate in ASCII format:
michael@0 818 </para>
michael@0 819 <programlisting>
michael@0 820 $ certutil -L -d sql:$HOME/nssdb -a -n my-ca-cert
michael@0 821 -----BEGIN CERTIFICATE-----
michael@0 822 MIIB1DCCAT2gAwIBAgICDkIwDQYJKoZIhvcNAQEFBQAwFTETMBEGA1UEAxMKRXhh
michael@0 823 bXBsZSBDQTAeFw0xMzAzMTMxOTEwMjlaFw0xMzA2MTMxOTEwMjlaMBUxEzARBgNV
michael@0 824 BAMTCkV4YW1wbGUgQ0EwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAJ4Kzqvz
michael@0 825 JyBVgFqDXRYSyTBNw1DrxUU/3GvWA/ngjAwHEv0Cul/6sO/gsCvnABHiH6unns6x
michael@0 826 XRzPORlC2WY3gkk7vmlsLvYpyecNazAi/NAwVnU/66HOsaoVFWE+gBQo99UrN2yk
michael@0 827 0BiK/GMFlLm5dXQROgA9ZKKyFdI0LIXtf6SbAgMBAAGjMzAxMBEGCWCGSAGG+EIB
michael@0 828 AQQEAwIHADAMBgNVHRMEBTADAQH/MA4GA1UdDwEB/wQEAwICBDANBgkqhkiG9w0B
michael@0 829 AQUFAAOBgQA6chkzkACN281d1jKMrc+RHG2UMaQyxiteaLVZO+Ro1nnRUvseDf09
michael@0 830 XKYFwPMJjWCihVku6bw/ihZfuMHhxK22Nue6inNQ6eDu7WmrqL8z3iUrQwxs+WiF
michael@0 831 ob2rb8XRVVJkzXdXxlk4uo3UtNvw8sAz7sWD71qxKaIHU5q49zijfg==
michael@0 832 -----END CERTIFICATE-----
michael@0 833 </programlisting>
michael@0 834 <para>For a human-readable display</para>
michael@0 835 <programlisting>$ certutil -L -d sql:$HOME/nssdb -n my-ca-cert
michael@0 836 Certificate:
michael@0 837 Data:
michael@0 838 Version: 3 (0x2)
michael@0 839 Serial Number: 3650 (0xe42)
michael@0 840 Signature Algorithm: PKCS #1 SHA-1 With RSA Encryption
michael@0 841 Issuer: "CN=Example CA"
michael@0 842 Validity:
michael@0 843 Not Before: Wed Mar 13 19:10:29 2013
michael@0 844 Not After : Thu Jun 13 19:10:29 2013
michael@0 845 Subject: "CN=Example CA"
michael@0 846 Subject Public Key Info:
michael@0 847 Public Key Algorithm: PKCS #1 RSA Encryption
michael@0 848 RSA Public Key:
michael@0 849 Modulus:
michael@0 850 9e:0a:ce:ab:f3:27:20:55:80:5a:83:5d:16:12:c9:30:
michael@0 851 4d:c3:50:eb:c5:45:3f:dc:6b:d6:03:f9:e0:8c:0c:07:
michael@0 852 12:fd:02:ba:5f:fa:b0:ef:e0:b0:2b:e7:00:11:e2:1f:
michael@0 853 ab:a7:9e:ce:b1:5d:1c:cf:39:19:42:d9:66:37:82:49:
michael@0 854 3b:be:69:6c:2e:f6:29:c9:e7:0d:6b:30:22:fc:d0:30:
michael@0 855 56:75:3f:eb:a1:ce:b1:aa:15:15:61:3e:80:14:28:f7:
michael@0 856 d5:2b:37:6c:a4:d0:18:8a:fc:63:05:94:b9:b9:75:74:
michael@0 857 11:3a:00:3d:64:a2:b2:15:d2:34:2c:85:ed:7f:a4:9b
michael@0 858 Exponent: 65537 (0x10001)
michael@0 859 Signed Extensions:
michael@0 860 Name: Certificate Type
michael@0 861 Data: none
michael@0 862
michael@0 863 Name: Certificate Basic Constraints
michael@0 864 Data: Is a CA with no maximum path length.
michael@0 865
michael@0 866 Name: Certificate Key Usage
michael@0 867 Critical: True
michael@0 868 Usages: Certificate Signing
michael@0 869
michael@0 870 Signature Algorithm: PKCS #1 SHA-1 With RSA Encryption
michael@0 871 Signature:
michael@0 872 3a:72:19:33:90:00:8d:db:cd:5d:d6:32:8c:ad:cf:91:
michael@0 873 1c:6d:94:31:a4:32:c6:2b:5e:68:b5:59:3b:e4:68:d6:
michael@0 874 79:d1:52:fb:1e:0d:fd:3d:5c:a6:05:c0:f3:09:8d:60:
michael@0 875 a2:85:59:2e:e9:bc:3f:8a:16:5f:b8:c1:e1:c4:ad:b6:
michael@0 876 36:e7:ba:8a:73:50:e9:e0:ee:ed:69:ab:a8:bf:33:de:
michael@0 877 25:2b:43:0c:6c:f9:68:85:a1:bd:ab:6f:c5:d1:55:52:
michael@0 878 64:cd:77:57:c6:59:38:ba:8d:d4:b4:db:f0:f2:c0:33:
michael@0 879 ee:c5:83:ef:5a:b1:29:a2:07:53:9a:b8:f7:38:a3:7e
michael@0 880 Fingerprint (MD5):
michael@0 881 86:D8:A5:8B:8A:26:BE:9E:17:A8:7B:66:10:6B:27:80
michael@0 882 Fingerprint (SHA1):
michael@0 883 48:78:09:EF:C5:D4:0C:BD:D2:64:45:59:EB:03:13:15:F7:A9:D6:F7
michael@0 884
michael@0 885 Certificate Trust Flags:
michael@0 886 SSL Flags:
michael@0 887 Valid CA
michael@0 888 Trusted CA
michael@0 889 User
michael@0 890 Email Flags:
michael@0 891 Valid CA
michael@0 892 Trusted CA
michael@0 893 User
michael@0 894 Object Signing Flags:
michael@0 895 Valid CA
michael@0 896 Trusted CA
michael@0 897 User
michael@0 898
michael@0 899 </programlisting>
michael@0 900
michael@0 901 <para><command>Listing Keys</command></para>
michael@0 902 <para>
michael@0 903 Keys are the original material used to encrypt certificate data. The keys generated for certificates are stored separately, in the key database.
michael@0 904 </para>
michael@0 905 <para>
michael@0 906 To list all keys in the database, use the <option>-K</option> command option and the (required) <option>-d</option> argument to give the path to the directory.
michael@0 907 </para>
michael@0 908 <programlisting>$ certutil -K -d sql:$HOME/nssdb
michael@0 909 certutil: Checking token "NSS Certificate DB" in slot "NSS User Private Key and Certificate Services "
michael@0 910 &lt; 0> rsa 455a6673bde9375c2887ec8bf8016b3f9f35861d Thawte Freemail Member's Thawte Consulting (Pty) Ltd. ID
michael@0 911 &lt; 1> rsa 40defeeb522ade11090eacebaaf1196a172127df Example Domain Administrator Cert
michael@0 912 &lt; 2> rsa 1d0b06f44f6c03842f7d4f4a1dc78b3bcd1b85a5 John Smith user cert</programlisting>
michael@0 913 <para>
michael@0 914 There are ways to narrow the keys listed in the search results:
michael@0 915 </para>
michael@0 916 <itemizedlist>
michael@0 917 <listitem>
michael@0 918 <para>
michael@0 919 To return a specific key, use the <option>-n</option> <emphasis>name</emphasis> argument with the name of the key.
michael@0 920 </para>
michael@0 921 </listitem>
michael@0 922 <listitem>
michael@0 923 <para>
michael@0 924 If there are multiple security devices loaded, then the <option>-h</option> <emphasis>tokenname</emphasis> argument can search a specific token or all tokens.
michael@0 925 </para>
michael@0 926 </listitem>
michael@0 927 <listitem>
michael@0 928 <para>
michael@0 929 If there are multiple key types available, then the <option>-k</option> <emphasis>key-type</emphasis> argument can search a specific type of key, like RSA, DSA, or ECC.
michael@0 930 </para>
michael@0 931 </listitem>
michael@0 932 </itemizedlist>
michael@0 933
michael@0 934 <para><command>Listing Security Modules</command></para>
michael@0 935 <para>
michael@0 936 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 <option>-U</option> command option lists all of the security modules listed in the <filename>secmod.db</filename> database. The path to the directory (<option>-d</option>) is required.
michael@0 937 </para>
michael@0 938 <programlisting>$ certutil -U -d sql:/home/my/sharednssdb
michael@0 939
michael@0 940 slot: NSS User Private Key and Certificate Services
michael@0 941 token: NSS Certificate DB
michael@0 942
michael@0 943 slot: NSS Internal Cryptographic Services
michael@0 944 token: NSS Generic Crypto Services</programlisting>
michael@0 945
michael@0 946 <para><command>Adding Certificates to the Database</command></para>
michael@0 947 <para>
michael@0 948 Existing certificates or certificate requests can be added manually to the certificate database, even if they were generated elsewhere. This uses the <option>-A</option> command option.
michael@0 949 </para>
michael@0 950 <programlisting>certutil -A -n certname -t trustargs -d [sql:]directory [-a] [-i input-file]</programlisting>
michael@0 951 <para>
michael@0 952 For example:
michael@0 953 </para>
michael@0 954 <programlisting>$ certutil -A -n "CN=My SSL Certificate" -t "u,u,u" -d sql:/home/my/sharednssdb -i /home/example-certs/cert.cer</programlisting>
michael@0 955 <para>
michael@0 956 A related command option, <option>-E</option>, is used specifically to add email certificates to the certificate database. The <option>-E</option> command has the same arguments as the <option>-A</option> command. The trust arguments for certificates have the format <emphasis>SSL,S/MIME,Code-signing</emphasis>, so the middle trust settings relate most to email certificates (though the others can be set). For example:
michael@0 957 </para>
michael@0 958 <programlisting>$ certutil -E -n "CN=John Smith Email Cert" -t ",Pu," -d sql:/home/my/sharednssdb -i /home/example-certs/email.cer</programlisting>
michael@0 959
michael@0 960 <para><command>Deleting Certificates to the Database</command></para>
michael@0 961 <para>
michael@0 962 Certificates can be deleted from a database using the <option>-D</option> option. The only required options are to give the security database directory and to identify the certificate nickname.
michael@0 963 </para>
michael@0 964 <programlisting>certutil -D -d [sql:]directory -n "nickname"</programlisting>
michael@0 965 <para>
michael@0 966 For example:
michael@0 967 </para>
michael@0 968 <programlisting>$ certutil -D -d sql:/home/my/sharednssdb -n "my-ssl-cert"</programlisting>
michael@0 969
michael@0 970 <para><command>Validating Certificates</command></para>
michael@0 971 <para>
michael@0 972 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 <option>-V</option> command option.
michael@0 973 </para>
michael@0 974 <programlisting>certutil -V -n certificate-name [-b time] [-e] [-u cert-usage] -d [sql:]directory</programlisting>
michael@0 975 <para>
michael@0 976 For example, to validate an email certificate:
michael@0 977 </para>
michael@0 978 <programlisting>$ certutil -V -n "John Smith's Email Cert" -e -u S,R -d sql:/home/my/sharednssdb</programlisting>
michael@0 979
michael@0 980 <para><command>Modifying Certificate Trust Settings</command></para>
michael@0 981 <para>
michael@0 982 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.
michael@0 983 </para>
michael@0 984 <programlisting>certutil -M -n certificate-name -t trust-args -d [sql:]directory</programlisting>
michael@0 985 <para>
michael@0 986 For example:
michael@0 987 </para>
michael@0 988 <programlisting>$ certutil -M -n "My CA Certificate" -d sql:/home/my/sharednssdb -t "CTu,CTu,CTu"</programlisting>
michael@0 989
michael@0 990 <para><command>Printing the Certificate Chain</command></para>
michael@0 991 <para>
michael@0 992 Certificates can be issued in <emphasis>chains</emphasis> because every certificate authority itself has a certificate; when a CA issues a certificate, it essentially stamps that certificate with its own fingerprint. The <option>-O</option> 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:
michael@0 993 </para>
michael@0 994 <programlisting>$ certutil -d sql:/home/my/sharednssdb -O -n "jsmith@example.com"
michael@0 995 "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]
michael@0 996
michael@0 997 "Thawte Personal Freemail Issuing CA - Thawte Consulting" [CN=Thawte Personal Freemail Issuing CA,O=Thawte Consulting (Pty) Ltd.,C=ZA]
michael@0 998
michael@0 999 "(null)" [E=jsmith@example.com,CN=Thawte Freemail Member]</programlisting>
michael@0 1000
michael@0 1001 <para><command>Resetting a Token</command></para>
michael@0 1002 <para>
michael@0 1003 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 (<option>-h</option>) as well as any directory path. If there is no external token used, the default value is internal.
michael@0 1004 </para>
michael@0 1005 <programlisting>certutil -T -d [sql:]directory -h token-name -0 security-officer-password</programlisting>
michael@0 1006 <para>
michael@0 1007 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:
michael@0 1008 </para>
michael@0 1009 <programlisting>$ certutil -T -d sql:/home/my/sharednssdb -h nethsm -0 secret</programlisting>
michael@0 1010
michael@0 1011 <para><command>Upgrading or Merging the Security Databases</command></para>
michael@0 1012 <para>
michael@0 1013 Many networks or applications may be using older BerkeleyDB versions of the certificate database (<filename>cert8.db</filename>). Databases can be upgraded to the new SQLite version of the database (<filename>cert9.db</filename>) using the <option>--upgrade-merge</option> command option or existing databases can be merged with the new <filename>cert9.db</filename> databases using the <option>---merge</option> command.
michael@0 1014 </para>
michael@0 1015 <para>
michael@0 1016 The <option>--upgrade-merge</option> command must give information about the original database and then use the standard arguments (like <option>-d</option>) 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.
michael@0 1017 </para>
michael@0 1018 <programlisting>certutil --upgrade-merge -d [sql:]directory [-P dbprefix] --source-dir directory --source-prefix dbprefix --upgrade-id id --upgrade-token-name name [-@ password-file]</programlisting>
michael@0 1019 <para>
michael@0 1020 For example:
michael@0 1021 </para>
michael@0 1022 <programlisting>$ certutil --upgrade-merge -d sql:/home/my/sharednssdb --source-dir /opt/my-app/alias/ --source-prefix serverapp- --upgrade-id 1 --upgrade-token-name internal</programlisting>
michael@0 1023 <para>
michael@0 1024 The <option>--merge</option> command only requires information about the location of the original database; since it doesn't change the format of the database, it can write over information without performing interim step.
michael@0 1025 </para>
michael@0 1026 <programlisting>certutil --merge -d [sql:]directory [-P dbprefix] --source-dir directory --source-prefix dbprefix [-@ password-file]</programlisting>
michael@0 1027 <para>
michael@0 1028 For example:
michael@0 1029 </para>
michael@0 1030 <programlisting>$ certutil --merge -d sql:/home/my/sharednssdb --source-dir /opt/my-app/alias/ --source-prefix serverapp-</programlisting>
michael@0 1031
michael@0 1032 <para><command>Running certutil Commands from a Batch File</command></para>
michael@0 1033 <para>
michael@0 1034 A series of commands can be run sequentially from a text file with the <option>-B</option> command option. The only argument for this specifies the input file.
michael@0 1035 </para>
michael@0 1036 <programlisting>$ certutil -B -i /path/to/batch-file</programlisting>
michael@0 1037 </refsection>
michael@0 1038
michael@0 1039 <refsection id="databases"><title>NSS Database Types</title>
michael@0 1040 <para>NSS originally used BerkeleyDB databases to store security information.
michael@0 1041 The last versions of these <emphasis>legacy</emphasis> databases are:</para>
michael@0 1042 <itemizedlist>
michael@0 1043 <listitem>
michael@0 1044 <para>
michael@0 1045 cert8.db for certificates
michael@0 1046 </para>
michael@0 1047 </listitem>
michael@0 1048 <listitem>
michael@0 1049 <para>
michael@0 1050 key3.db for keys
michael@0 1051 </para>
michael@0 1052 </listitem>
michael@0 1053 <listitem>
michael@0 1054 <para>
michael@0 1055 secmod.db for PKCS #11 module information
michael@0 1056 </para>
michael@0 1057 </listitem>
michael@0 1058 </itemizedlist>
michael@0 1059
michael@0 1060 <para>BerkeleyDB has performance limitations, though, which prevent it from being easily used by multiple applications simultaneously. NSS has
michael@0 1061 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
michael@0 1062 requires more flexibility to provide a truly shared security database.</para>
michael@0 1063
michael@0 1064 <para>In 2009, NSS introduced a new set of databases that are SQLite databases rather than
michael@0 1065 BerkeleyDB. These new databases provide more accessibility and performance:</para>
michael@0 1066 <itemizedlist>
michael@0 1067 <listitem>
michael@0 1068 <para>
michael@0 1069 cert9.db for certificates
michael@0 1070 </para>
michael@0 1071 </listitem>
michael@0 1072 <listitem>
michael@0 1073 <para>
michael@0 1074 key4.db for keys
michael@0 1075 </para>
michael@0 1076 </listitem>
michael@0 1077 <listitem>
michael@0 1078 <para>
michael@0 1079 pkcs11.txt, a listing of all of the PKCS #11 modules, contained in a new subdirectory in the security databases directory
michael@0 1080 </para>
michael@0 1081 </listitem>
michael@0 1082 </itemizedlist>
michael@0 1083
michael@0 1084 <para>Because the SQLite databases are designed to be shared, these are the <emphasis>shared</emphasis> database type. The shared database type is preferred; the legacy format is included for backward compatibility.</para>
michael@0 1085
michael@0 1086 <para>By default, the tools (<command>certutil</command>, <command>pk12util</command>, <command>modutil</command>) assume that the given security databases follow the more common legacy type.
michael@0 1087 Using the SQLite databases must be manually specified by using the <command>sql:</command> prefix with the given security directory. For example:</para>
michael@0 1088
michael@0 1089 <programlisting>$ certutil -L -d sql:/home/my/sharednssdb</programlisting>
michael@0 1090
michael@0 1091 <para>To set the shared database type as the default type for the tools, set the <envar>NSS_DEFAULT_DB_TYPE</envar> environment variable to <envar>sql</envar>:</para>
michael@0 1092 <programlisting>export NSS_DEFAULT_DB_TYPE="sql"</programlisting>
michael@0 1093
michael@0 1094 <para>This line can be set added to the <filename>~/.bashrc</filename> file to make the change permanent.</para>
michael@0 1095
michael@0 1096 <para>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:</para>
michael@0 1097 <itemizedlist>
michael@0 1098 <listitem>
michael@0 1099 <para>
michael@0 1100 https://wiki.mozilla.org/NSS_Shared_DB_Howto</para>
michael@0 1101 </listitem>
michael@0 1102 </itemizedlist>
michael@0 1103 <para>For an engineering draft on the changes in the shared NSS databases, see the NSS project wiki:</para>
michael@0 1104 <itemizedlist>
michael@0 1105 <listitem>
michael@0 1106 <para>
michael@0 1107 https://wiki.mozilla.org/NSS_Shared_DB
michael@0 1108 </para>
michael@0 1109 </listitem>
michael@0 1110 </itemizedlist>
michael@0 1111 </refsection>
michael@0 1112
michael@0 1113
michael@0 1114 <refsection id="seealso">
michael@0 1115 <title>See Also</title>
michael@0 1116 <para>pk12util (1)</para>
michael@0 1117 <para>modutil (1)</para>
michael@0 1118 <para><command>certutil</command> has arguments or operations that use features defined in several IETF RFCs.</para>
michael@0 1119 <itemizedlist>
michael@0 1120 <listitem>
michael@0 1121 <para>
michael@0 1122 http://tools.ietf.org/html/rfc5280
michael@0 1123 </para>
michael@0 1124 </listitem>
michael@0 1125 <listitem>
michael@0 1126 <para>
michael@0 1127 http://tools.ietf.org/html/rfc1113
michael@0 1128 </para>
michael@0 1129 </listitem>
michael@0 1130 <listitem>
michael@0 1131 <para>
michael@0 1132 http://tools.ietf.org/html/rfc1485
michael@0 1133 </para>
michael@0 1134 </listitem>
michael@0 1135 </itemizedlist>
michael@0 1136
michael@0 1137 <para>The NSS wiki has information on the new database design and how to configure applications to use it.</para>
michael@0 1138 <itemizedlist>
michael@0 1139 <listitem>
michael@0 1140 <para>
michael@0 1141 https://wiki.mozilla.org/NSS_Shared_DB_Howto</para>
michael@0 1142 </listitem>
michael@0 1143 <listitem>
michael@0 1144 <para>
michael@0 1145 https://wiki.mozilla.org/NSS_Shared_DB
michael@0 1146 </para>
michael@0 1147 </listitem>
michael@0 1148 </itemizedlist>
michael@0 1149 </refsection>
michael@0 1150
michael@0 1151 <!-- don't change -->
michael@0 1152 <refsection id="resources">
michael@0 1153 <title>Additional Resources</title>
michael@0 1154 <para>For information about NSS and other tools related to NSS (like JSS), check out the NSS project wiki at <ulink url="http://www.mozilla.org/projects/security/pki/nss/">http://www.mozilla.org/projects/security/pki/nss/</ulink>. The NSS site relates directly to NSS code changes and releases.</para>
michael@0 1155 <para>Mailing lists: https://lists.mozilla.org/listinfo/dev-tech-crypto</para>
michael@0 1156 <para>IRC: Freenode at #dogtag-pki</para>
michael@0 1157 </refsection>
michael@0 1158
michael@0 1159 <!-- fill in your name first; keep the other names for reference -->
michael@0 1160 <refsection id="authors">
michael@0 1161 <title>Authors</title>
michael@0 1162 <para>The NSS tools were written and maintained by developers with Netscape, Red Hat, Sun, Oracle, Mozilla, and Google.</para>
michael@0 1163 <para>
michael@0 1164 Authors: Elio Maldonado &lt;emaldona@redhat.com>, Deon Lackey &lt;dlackey@redhat.com>.
michael@0 1165 </para>
michael@0 1166 </refsection>
michael@0 1167
michael@0 1168 <!-- don't change -->
michael@0 1169 <refsection id="license">
michael@0 1170 <title>LICENSE</title>
michael@0 1171 <para>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/.
michael@0 1172 </para>
michael@0 1173 </refsection>
michael@0 1174
michael@0 1175 </refentry>

mercurial