Move everything from /var/adm to /var/log
[unleashed.git] / share / man / man1 / pktool.1
blob491d7c6493f9b540b57c90c40e7525f6b36583eb
1 '\" te
2 .\" Copyright (c) 2009, Sun Microsystems, Inc. All Rights Reserved
3 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License. You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.
4 .\"  See the License for the specific language governing permissions and limitations under the License. When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the
5 .\" fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
6 .TH PKTOOL 1 "Mar 23, 2009"
7 .SH NAME
8 pktool \- manage certificates and keys
9 .SH SYNOPSIS
10 .LP
11 .nf
12 \fBpktool\fR [\fB-f\fR \fIoption_file\fR] [\fB-i\fR] \fIsubcommand\fR \fIsubcommand_options\fR ...
13 .fi
15 .SH DESCRIPTION
16 .sp
17 .LP
18 The \fBpktool\fR command allows users to manage the certificates and keys on
19 multiple keystores including PKCS#11 tokens (that is, Cryptographic Framework),
20 Netscape Security Services (NSS) tokens, and standard file based keystore for
21 OpenSSL.
22 .sp
23 .LP
24 \fBpktool\fR also provides support to list, delete and import a Certificate
25 Revocation List (CRL). \fBpktool\fR does not provide support for creating CRLs,
26 signing CRLs, or exporting CRLs. The CRL support for the PKCS#11 keystore is
27 file-based.
28 .SH OPTIONS
29 .sp
30 .LP
31 The following command options are supported:
32 .sp
33 .ne 2
34 .na
35 \fB\fB-f\fR \fIoption_file\fR\fR
36 .ad
37 .RS 18n
38 Allows the user to set up the options in a file instead of entering the options
39 on the command line.
40 .sp
41 This option is provided as a convenience for users because \fBpktool\fR can
42 potentially have a large list of subcommands and associated options to be
43 specified on the command line.
44 .sp
45 The format of the \fIoption_file\fR is one option or value pair per-line.
46 .sp
47 An example \fIoption_file\fR might looks as follows:
48 .sp
49 .in +2
50 .nf
51 list
52 keystore=nss
53 dir=/export/foo
54 objtype=key
55 .fi
56 .in -2
57 .sp
59 .RE
61 .sp
62 .ne 2
63 .na
64 \fB\fB-i\fR\fR
65 .ad
66 .RS 18n
67 Allows the user to specify the \fBsubject-DN\fR interactively for the
68 \fBgencert\fR and \fBgencsr\fR subcommands. When \fB-i\fR is specified, the
69 user is prompted to input some data to form a \fBsubject-DN\fR.
70 .sp
71 An example of using the \fB-i\fR option follows:
72 .sp
73 .in +2
74 .nf
75 Country Name (2 letter code) [US]:US
76 State or Province Name (full name) [Some-State]:CA
77 Locality Name (eg, city) []:Menlo Park
78 Organization Name (eg, company):Sun Microsystems Inc.
79 Organizational Unit Name (eg, section):OPG
80 Common Name (eg, YOUR name):John Smith
81  Email Address []: john.smith@sun.com
82 .fi
83 .in -2
84 .sp
86 The resulting \fBsubject-DN\fR is:
87 .sp
88 .in +2
89 .nf
90 "C=US, ST=CA, L=Menlo Park, O=Sun Microsystems Inc.,\e
91    OU=OPG, emailAddress=john.smith@sun.com, \e
92    CN=John Smith"
93 .fi
94 .in -2
95 .sp
97 .RE
99 .SH SUBCOMMANDS
102 The following subcommands are supported:
104 .ne 2
106 \fB\fBdelete\fR\fR
108 .sp .6
109 .RS 4n
110 The format for the \fBdelete\fR subcommand is as follows:
112 .in +2
114 pktool delete [token=\fItoken\fR[:\fImanuf\fR[:\fIserial\fR]]]
115               [objtype=private|public|both]
116               [label=\fIobject-label\fR]
118 pktool delete keystore=pkcs11
119               objtype=cert[:public | private | both]]
120               [token=\fItoken\fR[:\fImanuf\fR[:\fIserial\fR]]]
121               [label=\fIcert-label\fR]
122               [serial=\fIhex-serial-number\fR]
123               [issuer=\fIissuer-DN\fR]
124               [subject=\fIsubject-DN\fR]
126 pktool delete keystore=nss
127               objtype=cert
128               [subject=\fIsubject-DN\fR]
129               [issuer=\fIissuer-DN\fR]
130               [serial=\fIhex-serial-number\fR]
131               [nickname=\fIcert-nickname\fR]
132               [token=\fItoken\fR[:\fImanuf\fR[:\fIserial\fR]]]
133               [dir=\fIdirectory-path\fR]
134               [prefix=\fIDBprefix\fR]
136 pktool delete keystore=nss
137               objtype=crl
138               [nickname=\fIcert-nickname\fR]
139               [subject=\fIsubject-DN\fR]
140               [token=\fItoken\fR[:\fImanuf\fR[:\fIserial\fR]]]
141               [dir=\fIdirectory-path\fR]
142               [prefix=\fIDBprefix\fR]
144 pktool delete keystore=pkcs11
145               objtype=key[:public | private | both]]
146               [token=\fItoken\fR[:\fImanuf\fR[:\fIserial\fR]]]
147               [label=\fIkey-label\fR]
149 pktool delete keystore=pkcs11
150               objtype=crl
151               infile=\fIinput-fn\fR
154 pktool delete keystore=file
155               objtype=cert
156               [infile=\fIinput-fn\fR]
157               [dir=\fIdirectory-path\fR]
158               [serial=\fIhex-serial-number\fR]
159               [issuer=\fIissuer-DN\fR]
160               [subject=\fIsubject-DN\fR]
162 pktool delete keystore=file
163               objtype=key
164               [infile=\fIinput-fn\fR]
165               [dir=\fIdirectory-path\fR]
167 pktool delete keystore=file
168               objtype=crl
169               infile=\fIinput-fn\fR
172 .in -2
175 Deletes a certificate, key, or certificate revocation list (CRL).
177 To delete a private certificate or key from PKCS#11 token, the user is prompted
178 to authenticate to the PKCS#11 by entering the correct Personal Identification
179 Number (PIN).
183 .ne 2
185 \fB\fBdownload\fR\fR
187 .sp .6
188 .RS 4n
189 The format for the \fBdownload\fR subcommand is as follows:
191 .in +2
193  pktool download url=\fIurl_str\fR
194                  [objtype=crl|cert]
195                  [http_proxy=\fIproxy_str\fR]
196                  [outfile=\fIoutput-fn\fR]
197                  [dir=\fIdirectory-path\fR]
199 .in -2
202 Downloads a CRL file or a certificate file from the specified URL location.
203 Once the file is successfully downloaded, checks the validity of the downloaded
204 CRL or certificate file. If the CRL or the certificate is expired,
205 \fBdownload\fR issues a warning.
209 .ne 2
211 \fB\fBexport\fR\fR
213 .sp .6
214 .RS 4n
215 The format for the \fBexport\fR subcommand is as follows:
217 .in +2
219 pktool export [token=\fItoken\fR[:\fImanuf\fR[:\fIserial\fR]]]
220               outfile=\fIoutput-fn\fR
222 pktool export keystore=pkcs11
223               outfile=\fIoutput-fn\fR
224               [objtype=cert|key]
225               [label=\fIlabel\fR]
226               [subject=\fIsubject-DN\fR]
227               [issuer=\fIissuer-DN\fR]
228               [serial=\fIhex-serial-number\fR]
229               [outformat=pem|der|pkcs12|raw]
230               [token=\fItoken\fR[:\fImanuf\fR[:\fIserial\fR]]]
232 pktool export keystore=nss
233               outfile=\fIoutput-fn\fR
234               [subject=\fIsubject-DN\fR]
235               [issuer=\fIissuer-DN\fR]
236               [serial=\fIhex-serial-number\fR]
237               [nickname=\fIcert-nickname\fR]
238               [token=\fItoken\fR[:\fImanuf\fR[:\fIserial\fR]]]
239               [dir=\fIdirectory-path\fR]
240               [prefix=\fIDBprefix\fR]
241               [outformat=pem|der|pkcs12]
243 pktool export keystore=file
244               certfile=\fIcert-input-fn\fR
245               keyfile=\fIkey-input-fn\fR
246               outfile=\fIoutput-pkcs12-fn\fR
248 .in -2
251 Saves the contents of PKCS#11 token or certificates in the NSS token or
252 file-based keystore to the specified file.
256 .ne 2
258 \fB\fBgencert\fR\fR
260 .sp .6
261 .RS 4n
262 The format for the \fBgencert\fR subcommand is as follows:
264 .in +2
266 pktool gencert [-i] keystore=nss
267               label=\fIcert-nickname\fR
268               subject=\fIsubject-DN\fR
269               serial=\fIhex_serial_number\fR
270               [altname=[critical:]\fIsubjectAltName\fR]
271               [keyusage=[critical:]\fIusage\fR,\fIusage\fR...]
272               [token=\fItoken\fR[:\fImanuf\fR[:\fIserial\fR]]]
273               [dir=\fIdirectory-path\fR]
274               [prefix=\fIDBprefix\fR]
275               [keytype=rsa|dsa]
276               [keylen=\fIkey-size\fR]
277               [trust=\fItrust-value\fR]
278               [lifetime=\fInumber\fR-hour|\fInumber\fR-day|\fInumber\fR-year]
279               [eku=[critical:]\fIEKU_name,...\fR]
281 pktool gencert [-i] [ keystore=pkcs11]
282               label=\fIkey/cert-label\fR
283               subject=\fIsubject-DN\fR
284               serial=\fIhex_serial_number\fR
285               [altname=[critical:]\fIsubjectAltName\fR]
286               [keyusage=[critical:]\fIusage\fR,\fIusage\fR...]
287               [token=\fItoken\fR[:\fImanuf\fR[:\fIserial\fR]]]
288               [keytype=rsa|dsa]
289               [keylen=\fIkey-size\fR]
290               [lifetime=\fInumber\fR-hour|\fInumber\fR-day|\fInumber\fR-year]
291               [eku=[critical:]\fIEKU_name,...\fR]
293 pktool gencert [-i] keystore=file
294               outcert=\fIcert-fn\fR
295               outkey=\fIkey-fn\fR
296               subject=\fIsubject-DN\fR
297               serial=\fIhex_serial_number\fR
298               [altname=[critical:]\fIsubjectAltName\fR]
299               [keyusage=[critical:]\fIusage\fR,\fIusage\fR...]
300               [format=der|pem]
301               [keytype=rsa|dsa]
302               [keylen=\fIkey-size\fR]
303               [lifetime=\fInumber\fR-hour|\fInumber\fR-day|\fInumber\fR-year]
304               [eku=[critical:]\fIEKU_name,...\fR]
306 .in -2
309 Generates a self-signed certificate and installs it and its associated private
310 key to the specified keystore.
312 \fBgencert\fR prompts the user to enter a PIN for token-based keystore.
316 .ne 2
318 \fB\fBgencsr\fR\fR
320 .sp .6
321 .RS 4n
322 The format for the \fBgencsr\fR subcommand is as follows:
324 .in +2
326 pktool gencsr [-i] keystore=nss
327               nickname=\fIkey-nickname\fR
328               outcsr=\fIcsr-fn\fR
329               subject=\fIsubject-DN\fR
330               [altname=[critical:]\fIsubjectAltName\fR]
331               [keyusage=[critical:]\fIusage\fR,\fIusage\fR...]
332               [token=\fItoken\fR[:\fImanuf\fR[:\fIserial\fR]]]
333               [dir=\fIdirectory-path\fR]
334               [prefix=\fIDBprefix\fR]
335               [keytype=rsa|dsa]
336               [keylen=\fIkey-size\fR]
337               [format=pem|der]
338               [eku=[critical:]\fIEKU_name,...\fR]
340 pktool gencsr [-i] keystore=pkcs11
341               label=\fIkey-label\fR
342               outcsr=\fIcsr-fn\fR
343               subject=\fIsubject-DN\fR
344               [altname=[critical:]\fIsubjectAltName\fR]
345               [keyusage=[critical:]\fIusage\fR,\fIusage\fR...]
346               [token=\fItoken\fR[:\fImanuf\fR[:\fIserial\fR]]]
347               [keytype=rsa|dsa]
348               [keylen=\fIkey-size\fR]
349               [format=pem|der]
350               [eku=[critical:]\fIEKU_name,...\fR]
352 pktool gencsr [-i] keystore=file
353               outcsr=\fIcsr-fn\fR
354               outkey=\fIkey-fn\fR
355               subject=\fIsubject-DN\fR
356               [altname=[critical:]\fIsubjectAltName\fR]
357               [keyusage=[critical:]\fIusage,usage...\fR]
358               [dir=\fIdirectory-path\fR]
359               [keytype=rsa|dsa]
360               [keylen=\fIkey-size\fR]
361               [format=pem|der]
362               [eku=[critical:]\fIEKU_name,...\fR]
364 .in -2
367 Creates a PKCS#10 certificate signing request (CSR) file. This CSR can be sent
368 to a Certifying Authority (CA) for signing. The \fBgencsr\fR subcommand prompts
369 the user to enter a PIN for token-based keystore.
373 .ne 2
375 \fB\fBgenkey\fR\fR
377 .sp .6
378 .RS 4n
379 The format for the \fBgenkey\fR subcommand is as follows:
381 \fB\fR
383 .in +2
385 pktool genkey [keystore=pkcs11]
386               label=\fIkey-label\fR
387               [keytype=aes|arcfour|des|3des|generic]
388               [keylen=\fIkey-size\fR (for aes, arcfour, or \e
389                   generic keytypes only)]
390               [token=\fItoken\fR[:\fImanuf\fR[:\fIserial\fR]]]
391               [sensitive=y|n]
392               [extractable=y|n]
393               [print=y|n]
395 pktool genkey keystore=nss
396               label=\fIkey-label\fR
397               [keytype=aes|arcfour|des|3des|generic]
398               [keylen=\fIkey-size\fR (for aes, arcfour, or \e
399                   generic keytypes only)]
400               [token=\fItoken\fR[:\fImanuf\fR[:\fIserial\fR]]]
401               [dir=\fIdirectory-path\fR]
402               [prefix=\fIDBprefix\fR]
404 pktool genkey keystore=file
405               outkey=\fIkey-fn\fR
406               [keytype=aes|arcfour|des|3des|generic]
407               [keylen=\fIkey-size\fR (for aes, arcfour, \e
408                    or generic keytypes only)]
409               [print=y|n]
411 .in -2
414 Generates a symmetric key in the specified keystore. The \fBgenkey\fR
415 subcommand prompts the user to enter a PIN for token-based keystore.
419 .ne 2
421 \fB\fBimport\fR\fR
423 .sp .6
424 .RS 4n
425 The format for the \fBimport\fR subcommand is as follows:
427 .in +2
429 pktool import [token=\fItoken\fR>[:\fImanuf\fR>[:\fIserial\fR>]]]
430               infile=\fIinput-fn\fR
432 pktool import [keystore=pkcs11]
433               infile=\fIinput-fn\fR
434               label=\fIobject-label\fR
435               [keytype=aes|arcfour|des|3des|generic]
436               [sensitive=y|n]
437               [extractable=y|n]
438               [token=\fItoken\fR[:\fImanuf\fR[:\fIserial\fR]]]
439               [objtype=cert|key]
441 pktool import keystore=pkcs11
442               objtype=\fIcrl\fR
443               infile=\fIinput-fn\fR
444               outcrl=\fIoutput-crl-fn\fR
445               outformat=pem|der
447 pktool import keystore=nss
448               objtype=\fIcert\fR
449               infile=\fIinput-fn\fR
450               label=\fIcert-label\fR
451               [token=\fItoken\fR[:\fImanuf\fR[:\fIserial\fR]]]
452               [dir=\fIdirectory-path\fR]
453               [prefix=\fIDBprefix\fR]
454               [trust=\fItrust-value\fR]
456 pktool import keystore=nss
457               objtype=crl
458               infile=\fIinput-fn\fR
459               [verifycrl=y|n]
460               [token=\fItoken\fR[:\fImanuf\fR[:\fIserial\fR]]]
461               [dir=\fIdirectory-path\fR]
462               [prefix=\fIDBprefix\fR]
464 pktool import keystore=file
465               infile=\fIinput-fn\fR
466               outkey=\fIoutput-key-fn\fR
467               outcert=\fIoutput-key-fn\fR
468               [outformat=pem|der]
470 pktool import keystore=file
471               objtype=crl
472               infile=\fIinput-fn\fR
473               outcrl=\fIoutput-crl-fn\fR
474               outformat=pem|der
476 .in -2
479 Loads certificates, keys, or CRLs from the specified input file into the
480 specified keystore.
484 .ne 2
486 \fB\fBinittoken\fR\fR
488 .sp .6
489 .RS 4n
490 The format for the \fBinittoken\fR subcommand is as follows:
492 .in +2
494 pktool inittoken [ slotid=slot number ]
495                  [ currlabel=token[:manuf[:serial]]]
496                  [ newlabel=new token label ]
498 .in -2
501 This command initializes a PKCS#11 token using \fBC_InitToken API\fR.  The
502 preferred method of locating a token is to specify its default label.
503 Optionally, a new label can be assigned to the token by using the
504 \fBnewlabel\fR argument.  If \fBnewlabel\fR is not present, the token label is
505 not modified.  The user is prompted to enter the security officer (SO) PIN for
506 this  command to proceed.
510 .ne 2
512 \fB\fBlist\fR\fR
514 .sp .6
515 .RS 4n
516 The format for the \fBlist\fR subcommand is as follows:
518 .in +2
520 pktool list [token=\fItoken\fR[:\fImanuf\fR[:\fIserial\fR]]]
521             [objtype=private|public|both]
522             [label=\fIlabel\fR]
524 pktool list [keystore=pkcs11]
525             [objtype=cert[:public | private | both]]
526             [token=\fItoken\fR[:\fImanuf\fR[:\fIserial\fR]]]
527             [label=\fIcert-label\fR]
528             [serial=\fIhex-serial-number\fR]
529             [issuer=\fIissuer-DN\fR]
530             [subject=\fIsubject-DN\fR]
532 pktool list [keystore=pkcs11]
533             objtype=key[:public | private | both]]
534             [token=\fItoken\fR[:\fImanuf\fR[:\fIserial\fR]]]
535             [label=\fIkey-label\fR]
537 pktool list keystore=pkcs11
538             objtype=crl
539             infile=\fIinput-fn\fR
541 pktool list keystore=nss
542             objtype=cert
543             [subject=\fIsubject-DN\fR]
544             [issuer=\fIissuer-DN\fR]
545             [serial=\fIhex-serial-number\fR]
546             [nickname=\fIcert-nickname\fR]
547             [token=\fItoken\fR[:\fImanuf\fR[:\fIserial\fR]]]
548             [dir=\fIdirectory-path\fR]
549             [prefix=\fIDBprefix\fR]
551 pktool list keystore=nss
552             objtype=key
553             [token=\fItoken\fR[:\fImanuf\fR[:\fIserial\fR]]]
554             [dir=\fIdirectory-path\fR]
555             [prefix=\fIDBprefix\fR]
557 pktool list keystore=file
558             objtype=cert
559             [infile=\fIinput-fn\fR]
560             [dir=\fIdirectory-path\fR]
561             [serial=\fIhex-serial-number\fR]
562             [issuer=\fIissuer-DN\fR]
563             [subject=\fIsubject-DN\fR]
565 pktool list keystore=file
566             objtype=\fIkey\fR
567             [infile=\fIinput-fn\fR]
568             [dir=\fIdirectory-path\fR]
570 .in -2
573 Lists certificates, list keys, or list certificate revocation lists (CRL). When
574 displaying a private certificate or key in PKCS#11 token, the user is prompted
575 to authenticate to the PKCS#11 token by entering the correct PIN.
579 .ne 2
581 \fB\fBsetpin\fR\fR
583 .sp .6
584 .RS 4n
585 The format for the \fBsetpin\fR subcommand is as follows:
587 .in +2
589 pktool setpin keystore=nss
590        [token=\fItoken\fR]
591        [dir=\fIdirectory-path\fR]
592        [prefix=\fIDBprefix\fR]
594 pktool setpin [ keystore=pkcs11]
595        [token=\fItoken\fR[:\fImanuf\fR[:\fIserial\fR]]]
596        [usertype=user | so]
598 .in -2
601 Changes the passphrase used to authenticate a user to the PKCS#11 or NSS token.
602 Passphrases can be any string of characters with lengths between 1 and 256 with
603 no nulls.
605 \fBsetpin\fR prompts the user for the old passphrase, if any. If the old
606 passphrase matches, \fBpktool\fR prompts for the new passphrase twice. If the
607 two entries of the new passphrases match, it becomes the current passphrase for
608 the token.
610 For the Sun Software PKCS#11 softtoken keystore (default), the user must use
611 the \fBsetpin\fR command with the default passphrase \fBchangeme\fR as the old
612 passphrase to change the passphrase of the object store.  This action is needed
613 to initialize and set the passphrase to a newly created token object store.
615 If the \fBusertype=so\fR option is specified for PKCS#11 based tokens, the
616 Security Officer (SO) user PIN is changed as opposed to the normal user PIN.
617 By default the \fBusertype\fR is assumed to be \fBuser\fR.
621 .ne 2
623 \fB\fBsigncsr\fR\fR
625 .sp .6
626 .RS 4n
627 The format for the \fBsigncsr\fR subcommand is as follows:
629 .in +2
631 signcsr keystore=pkcs11
632         signkey=\fIlabel\fR (label of key to use for signing)
633         csr=\fICSR_filename\fR
634         serial=\fIserial_number_hex_string_for_final_certificate\fR
635         outcert=\fIfilename_for_final_certificate\fR
636         issuer=\fIissuer-DN\fR
637         [store=y|n] (store the new cert in NSS DB, default=n)
638         [outlabel=\fIcertificate label\fR]
639         [format=pem|der] (certificate output format)
640         [subject=\fIsubject-DN\fR] (override the CSR subject name)
641         [altname=\fIsubjectAltName\fR] (add subjectAltName )
642         [keyusage=[critical:]\fIusage,...\fR] (add key usage bits)
643         [eku=[critical:]\fIEKU_Name,...\fR] (add Extended Key Usage )
644         [lifetime=\fInumber-hour\fR|\fInumber-day\fR|\fInumber-year\fR]
645         [token=\fItoken\fR[:\fImanuf\fR[:\fIserial\fR]]]
646 signcsr keystore=\fIfile\fR
647         signkey=\fIfilename\fR
648         csr=\fICSR_filename\fR
649         serial=\fIserial_number_hex_string_for_final_certificate\fR
650         outcert=\fIfilename_for_final_certificate\fR
651         issuer=\fIissuer-DN\fR
652         [format=pem|der] (certificate output format)
653         [subject=\fIsubject-DN\fR] (override the CSR subject name)
654         [altname=\fIsubjectAltName\fR] (add a subjectAltName)
655         [keyusage=[critical:]\fIusage,...\fR] (add key usage bits)
656         [lifetime=\fInumber-hour\fR|\fInumber-day\fR|\fInumber-year\fR]
657         [eku=[critical:]\fIEKU_ Name,...\fR] (add Extended Key Usage)
658 signcsr keystore=nss
659         signkey=\fIlabel\fR (label of key to use for signing)
660         csr=\fICSR_filename\fR
661         serial=\fIserial_number_hex_string_for_final_certificate\fR
662         outcert=\fIfilename_for_final_certificate\fR
663         issuer=\fIissuer-DN\fR
664         [store=y|n] (store the new cert in NSS DB, default=n)
665         [outlabel=\fIcertificate label\fR]
666         [format=pem|der] (certificate output format)
667         [subject=\fIsubject-DN\fR] (override the CSR subject name)
668         [altname=\fIsubjectAltName\fR] (add a subjectAltName)
669         [keyusage=[critical:]\fIusage,...\fR] (add key usage bits)
670         [eku=[critical:]\fIEKU_Name,...\fR] (add Extended Key Usage)
671         [lifetime=\fInumber-hour\fR|\fInumber-day\fR|\fInumber-year\fR]
672         [token=token[\fI:manuf\fR[:\fIserial\fR]]]
673         [dir=\fIdirectory-path\fR]
674         [prefix=\fIDBprefix\fR]
676 .in -2
682 .ne 2
684 \fB\fBtokens\fR\fR
686 .sp .6
687 .RS 4n
688 The format for the \fBtokens\fR subcommand is as follows:
690 .in +2
692 pktool tokens
694 .in -2
697 The tokens subcommand lists all visible PKCS#11 tokens.
701 .ne 2
703 \fB\fB-?\fR\fR
705 .sp .6
706 .RS 4n
707 The format for the \fB\fR subcommand is as follows:
709 .in +2
711 pktool -?
712 pktool --help
714 .in -2
717 The \fB-?\fR option displays usage and help information. \fB--help\fR is a
718 synonym for \fB-?\fR.
721 .SH USAGE
724 The \fBpktool\fR subcommands support the following options:
726 .ne 2
728 \fBaltname=[critical:]\fIsubjectAltName\fR\fR
730 .sp .6
731 .RS 4n
732 Subject Alternative Names the certificate. The argument that follows the -A
733 option should be in the form of tag=value. Valid tags are IP, DNS, EMAIL, URI,
734 DN, KRB, UPN, and RID. The SubjectAltName extension is marked as \fBcritical\fR
735 if the altname string is pre-peneded with the
737 Example 1: Add an IP address to the \fIsubjectAltName\fR extension.
738 \fBaltname="IP=1.2.3.4"\fR Example 2: Add an email address to the
739 \fIsubjectAltName\fR extension, and mark it as being critical.
740 \fBaltname="critical:EMAIL=first.last@company.com"\fR
744 .ne 2
746 \fB\fBcurrlabel=token label\fR\fR
748 .sp .6
749 .RS 4n
750 This option is only used by the \fBinittoken\fR command.  This  is used to
751 locate the default token that is being initialized.  See the \fBtoken\fR option
752 for details about the format  of the token name to be used.
756 .ne 2
758 \fB\fBdir=\fR\fIdirectory_path\fR\fR
760 .sp .6
761 .RS 4n
762 Specifies the NSS database directory, or OpenSSL keystore directory where the
763 requested object is stored.
767 .ne 2
769 \fB\fBeku\fR=[critical:]\fIEKU_Name\fR,[critical:]\fIEKU_Name, ...\fR]\fR
771 .sp .6
772 .RS 4n
773 Specifies the extended key usage X.509v3 extension values to add to the
774 certificate or certificate request.
776 Specify \fIEKU_Name\fR as one of the following:   \fBserverAuth\fR,
777 \fBclientAuth\fR, \fBcodeSigning\fR, \fBemailProtection\fR,
778 \fBipsecEndSystem\fR, \fBipsecTunnel\fR, \fBipsecUser\fR, \fBtimeStamping\fR,
779 \fBOCSPSigning\fR, \fBKPClientAuth\fR, \fBKPKdc\fR, or \fBscLogon\fR.
781 An example is:
783 .in +2
785 eku=KPClientAuth,clientAuth
787 .in -2
793 .ne 2
795 \fB\fBextractable=y | n\fR\fR
797 .sp .6
798 .RS 4n
799 Specifies the resulting symmetric key in the PKCS#11 token is extractable or
800 not extractable. The valid values are: \fBy\fR and \fBn\fR. The default value
801 is \fBy\fR.
805 .ne 2
807 \fBformat=pem | der | pkcs12\fR
809 .sp .6
810 .RS 4n
811 For the \fBgencert\fR subcommand, this option only applies to the file based
812 keystore such as OpenSSL. It is used to specify the output format of the key or
813 certificate file to be created. The valid formats are: \fBpem\fR or \fBder\fR.
814 The default format is \fBpem\fR.
816 For the \fBgencsr\fR subcommand, this option specifies the output encoded
817 format of the CSR file. The valid formats are: \fBpem\fR or \fBder\fR. The
818 default format is \fBpem\fR.
822 .ne 2
824 \fB\fBinfile=\fR\fIinput-fn\fR\fR
826 .sp .6
827 .RS 4n
828 Specifies the certificate filename for \fBlist\fR and \fBdelete\fR subcommands
829 when objtype=cert and keystore=file. For the \fBimport\fR subcommand, this
830 option specifies the filename to be imported. Specifies the input CRL filename
831 for \fBlist\fR, \fBdelete\fR and \fBimport\fR subcommands when
832 \fBobjtype=crl\fR.
836 .ne 2
838 \fB\fBissuer=\fR\fIissuer-DN\fR\fR
840 .sp .6
841 .RS 4n
842 Specifies the issuer of a certificate.
846 .ne 2
848 \fB\fBkeylen=\fR\fIkey-size\fR\fR
850 .sp .6
851 .RS 4n
852 Specifies the size (bits) of the private or symmetric key to generate.
854 For the \fBgencert\fR and \fBgencsr\fR subcommands, the default key length is
855 1024 bits.
857 For the \fBgenkey\fR subcommand, the minimum and maximum bits of the symmetric
858 key to generate using AES algorithm are \fB128\fR and \fB256\fR. Using the
859 ARCFOUR algorithm, the minimum and maximum bits are \fB8\fR and \fB2048\fR. The
860 minimum bits for a generic secret key is \fB8\fR and the maximum bits is
861 arbitrary. The default key length for the AES, ARCFOUR or generic secret keys
862 is 128. For a DES key or a 3DES key, the key length is fixed and this option is
863 ignored if specified.
867 .ne 2
869 \fBkeystore=\fBnss | pkcs11 | file\fR\fR
871 .sp .6
872 .RS 4n
873 Specifies the type of the underlying keystore: NSS token, PKCS#11 token, or
874 file-based plugin.
878 .ne 2
880 \fB\fBkeytype=rsa | dsa | aes | arcfour | des | 3des | generic\fR\fR
882 .sp .6
883 .RS 4n
884 Specifies the type of the private or symmetric key to generate.
886 For the \fBgencert\fR and \fBgencsr\fR subcommands, the valid private key types
887 are: \fBrsa\fR, or \fBdsa\fR. The default key type is \fBrsa\fR.
889 For the \fBgenkey\fR subcommand, the valid symmetric key types are: \fBaes\fR,
890 \fBarcfou\fRr, \fBdes\fR, \fB3des\fR, or \fBgeneric\fR. The default key type is
891 \fBaes\fR.
893 .in +2
895  keyusage=[critical:]usage,usage,usage,...
897 .in -2
901 .in +2
903 Key Usage strings:
904 * digitalSignature
905 * nonRepudiation
906 * keyEncipherment
907 * dataEncipherment
908 * keyAgreement
909 * keyCertSign
910 * cRLSign
911 * encipherOnly
912 * decipherOnly
914 .in -2
917 Example 1: Set the KeyUsage so that the cert (or csr) can be used for signing
918 and verifying data other than certificates or CRLs (digitalSignature) and also
919 can be used for encrypting and decrypting data other than cryptographic keys
920 (dataEncipherment). keyusage=digitalSignature,dataEncipherment
922 Example 2: The same as above (Example 1), but with the critical bit set.
923 keyusage=critical:digitalSignature,dataEncipherment
927 .ne 2
929 \fB\fBlabel=\fIkey-label\fR | \fIcert-label\fR\fR\fR
931 .sp .6
932 .RS 4n
933 For the \fBgencert\fR subcommand, this option specifies the label of the
934 private key and self-signed certificate in the PKCS#11 token.
936 For the \fBgencsr\fR subcommand, this option specifies the label of the private
937 key in the PKCS#11 token.
939 For the \fBlist\fR subcommand, this option specifies the label of the X.509
940 Certificate (when \fBobjtype=key\fR) or the private key (when
941 \fBobjtype=cert\fR) in the PKCS#11 token to refine the list.
943 For the \fBdelete\fR subcommand, this option specifies the label of the X.509
944 Certificate (when \fBobjtype=key\fR) or the private key (when
945 \fBobjtype=cert\fR) to delete a designated object from the PKCS#11 token.
949 .ne 2
951 \fB\fBlifetime=\fInumber\fR-hour|\fInumber\fR-day|\fInumber\fR-year\fR\fR
953 .sp .6
954 .RS 4n
955 Specifies the validity period a certificate is valid. The certificate life time
956 can be specified by \fInumber\fR\fB-hour\fR, \fInumber\fR\fI-day\fR, or
957 \fInumber\fR\fB-year\fR. Only one format can be specified. The default is
958 \fB1-year\fR. Examples of this option might be: \fBlifetime=1-hour,
959 lifetime=2-day, lifetime=3-year\fR
963 .ne 2
965 \fB\fBnewlabel=token label\fR\fR
967 .sp .6
968 .RS 4n
969 This option is only used by the \fBinittoken\fR command.  This  is used to
970 change the label assigned to the token that is  being initialized.  See the
971 \fBtoken\fR option for details about the format  of the token name to be used.
975 .ne 2
977 \fB\fBnickname=\fR\fIcert-nickname\fR\fR
979 .sp .6
980 .RS 4n
981 For the \fBgencert\fR subcommand, this option is required to specify the
982 certificate's nickname for NSS keystore.
984 For the \fBlist\fR subcommand, this option specifies the nickname of the
985 certificate in the NSS token to display its content. For the \fBdelete\fR
986 subcommand, to delete a CRL from the NSS token, this option is used to specify
987 the nickname of the issuer's certificate. For the \fBdelete\fR subcommand, to
988 delete a certificate from the NSS token, this option specifies the nickname of
989 the certificate. For the \fBimport\fR subcommand, to import a specified input
990 file to the NSS token, this option is required to specify the nickname of the
991 resulting certificate.
995 .ne 2
997 \fB\fBobjtype=cert | key | crl\fR\fR
999 .sp .6
1000 .RS 4n
1001 Specifies the class of the object: \fBcert,\fR \fBkey,\fR or \fBcrl\fR. For the
1002 \fBdownload\fR subcommand, if this option is not specified, default to
1003 \fBcrl\fR.
1007 .ne 2
1009 \fB\fBobjtype=public | private | both\fR\fR
1011 .sp .6
1012 .RS 4n
1013 Specifies the type of object: private object, public object, or both. This
1014 option only applies to \fBlist\fR and \fBdelete\fR subcommands for the PKCS#11
1015 token when \fBobjtype=key\fR is specified. The default value is \fBpublic\fR.
1017 For the \fBlist\fR subcommand, the label option can be combined with this
1018 option to further refine the list of keys. For the \fBdelete\fR subcommand,
1019 this option can used to narrow the keys to be deleted to only public, or
1020 private ones. Alternately, the label option can be omitted to indicate that all
1021 public, private, or both type of keys are to be deleted.The use of
1022 \fBpublic\fR, \fBprivate\fR and \fBboth\fR as choices for the \fBobjtype\fR
1023 parameter are only applicable with the PKCS#11 keystore in order to maintain
1024 compatibility with earlier versions of the \fBpktool\fR command.
1028 .ne 2
1030 \fB\fBoutcert=\fR\fIcert-fn\fR\fR
1032 .sp .6
1033 .RS 4n
1034 Specifies the output certificate filename to write to. This option is required
1035 for the file based plugin such as OpenSSL. Option \fBoutkey=\fR\fIkey-fn\fR is
1036 required with this option.
1040 .ne 2
1042 \fB\fBoutcrl=\fIoutput-crl-fn\fR\fR\fR
1044 .sp .6
1045 .RS 4n
1046 Specifies the output CRL filename to write to.
1050 .ne 2
1052 \fB\fBoutcsr=\fR\fIcsr-fn\fR\fR
1054 .sp .6
1055 .RS 4n
1056 Specifies the output CSR filename to write to.
1060 .ne 2
1062 \fB\fBoutfile=\fR\fIoutput-fn\fR\fR
1064 .sp .6
1065 .RS 4n
1066 For the \fBexport\fR subcommand, this option specifies the output filename to
1067 be created. For the \fBimport\fR subcommand, this option specifies the output
1068 filename of the certificate or CRL. It only applies to the file based plugin
1069 such as OpenSSL.  For the \fBdownload\fR subcommand, if this option is not
1070 specified, the downloaded file name is the basename of the URL string.
1074 .ne 2
1076 \fB\fBoutformat=pem | der | pkcs12\fR\fR
1078 .sp .6
1079 .RS 4n
1080 For the \fBimport\fR subcommand, this option specifies the output format of the
1081 certificate or key that is extracted from a specified PKCS#12 file into the
1082 file based plugin, The valid values are: \fBpem\fR or \fBder\fR. The default is
1083 \fBpem\fR. When importing a CRL to the CRL file based keystore, this option
1084 specifies the output format of the CRL. The valid values are: \fBpem\fR or
1085 \fBder\fR. The default is \fBder\fR. For the \fBexport\fR subcommand, this
1086 option specifies the format of the specified output file to be created. The
1087 supported formats are: \fBpem\fR, \fBder\fR or \fBpkcs12\fR. The default is
1088 \fBpkcs12\fR.
1092 .ne 2
1094 \fB\fBoutkey=\fR\fIkey-fn\fR\fR
1096 .sp .6
1097 .RS 4n
1098 Specifies the output private key filename to which to write. This option is
1099 only required when using the \fBfiles\fR keystore.
1103 .ne 2
1105 \fB\fBprefix=\fR\fIDBprefix\fR\fR
1107 .sp .6
1108 .RS 4n
1109 Specifies the NSS database prefix. This option only applies to the NSS token.
1113 .ne 2
1115 \fB\fBprint=y | n\fR\fR
1117 .sp .6
1118 .RS 4n
1119 This option is used in the \fBgenkey\fR subcommand and it applies to the PKCS11
1120 and File-based keystores. If \fBprint=y\fR, the \fBgenkey\fR subcommand prints
1121 out the key value of the generated key in a single line of hex. The default
1122 value is \fBn\fR.  For the PKCS11 keystore, if a symmetric key is created with
1123 \fBsensitive=y\fR or \fBextractable=n\fR, the key value is not displayed, even
1124 the \fBprint\fR option is set to \fBy\fR. The key is still created, but a
1125 warning like \fBcannot reveal the key value\fR is issued.
1129 .ne 2
1131 \fB\fBsensitive=y | n\fR\fR
1133 .sp .6
1134 .RS 4n
1135 Specifies the resulting symmetric key in the PKCS#11 token is sensitive or not
1136 sensitive. The valid values are: \fBy\fR and \fBn\fR. The default value is
1137 \fBn\fR.
1141 .ne 2
1143 \fB\fBserial=\fR\fIhex-serial-number\fR\fR
1145 .sp .6
1146 .RS 4n
1147 Specifies a unique serial number for a certificate. The serial number must be
1148 specified as a hex value. Example: \fB0x0102030405060708090a0b0c0d0e0f\fR
1152 .ne 2
1154 \fB\fBsubject=\fR\fIsubject-DN\fR\fR
1156 .sp .6
1157 .RS 4n
1158 Specifies a particular certificate owner for a certificate or certificate
1159 request. An example \fBsubject=\fR setting might be:
1161 .in +2
1163 subject=O=Sun Microsystems Inc., \e
1164 OU=Solaris Security Technologies Group, \e
1165 L=Ashburn, ST=VA, C=US, CN=John Smith
1167 .in -2
1173 .ne 2
1175 \fB\fBtoken=\fItoken\fR[:\fImanuf\fR[:\fIserial\fR]]\fR\fR
1177 .sp .6
1178 .RS 4n
1179 When a token label contains trailing spaces, this option does not require them
1180 to be typed as a convenience to the user.
1182 Colon separate token identification string
1183 \fB\fItoken\fR:\fImanuf\fR:\fIserial\fR\fR. If any of the parts have a literal
1184 \fB:\fR char then it needs to be escaped using a backslash (\fB\e\fR). If no
1185 \fB:\fR is found then the entire string (up to 32 chars) is taken as the token
1186 label. If only one \fB:\fR is found then the string is the token label and the
1187 manufacturer. When \fBkeystore=nss\fR is specified, default to NSS internal
1188 token if this option is not specified. When \fBkeystore=pkcs11\fR is specified,
1189 default to \fBpkcs11_softtoken\fR if this option is not specified.
1193 .ne 2
1195 \fB\fBtrust=\fItrust\fR-\fIvalue\fR\fR\fR
1197 .sp .6
1198 .RS 4n
1199 Specifies the certificate trust attributes. This is only for NSS certificates
1200 and that the standard NSS syntax applies.
1204 .ne 2
1206 \fB\fBusertype=user | so\fR\fR
1208 .sp .6
1209 .RS 4n
1210 Specifies the type of user for which the \fBsetpin\fR command   is being
1211 performed.  The default is for a standard user,   but \fBso\fR can be specified
1212 in order to set the PIN for  the security officer of the token.
1216 .ne 2
1218 \fB\fBurl=\fR\fIurl_string\fR\fR
1220 .sp .6
1221 .RS 4n
1222 Specifies the URL to download a CRL or a certificate file.
1226 .ne 2
1228 \fB\fBverifycrl=y | n\fR\fR
1230 .sp .6
1231 .RS 4n
1232 When importing a CRL to NSS keystore, this option specifies whether the CRL
1233 verification is performed. The valid values are: \fBy\fR and \fBn\fR. The
1234 default value is \fBn\fR.
1238 .ne 2
1240 \fB\fBhttp_proxy=\fR\fIproxy_str\fR\fR
1242 .sp .6
1243 .RS 4n
1244 Specifies the proxy server hostname and port number. The format can be either
1245 \fIhttp\fR\fB://\fIhostname\fR[:\fIport\fR]\fR or
1246 \fIhostname\fR\fB[:\fIport\fR]\fR. If this option is not specified, the
1247 \fBdownload\fR subcommand checks the \fBhttp_proxy\fR environment variable. The
1248 command line option has a higher priority than the environment variable.
1251 .SH EXAMPLES
1253 \fBExample 1 \fRGenerating a Self-Signed Certificate
1256 The following example creates the certificate and stores it in the keystore
1257 indicated in the command:
1260 .in +2
1262  $ pktool gencert keystore=nss nickname=WebServerCert \e
1263        subject="O=Sun Microsystems Inc., OU=Solaris Security Technologies Group, \e
1264        L=Ashburn, ST=VA, C=US, CN=John Smith" dir=/etc/certs \e
1265        keytype=rsa keylen=2048
1267 .in -2
1271 \fBExample 2 \fRGenerating a Certificate Signing Request
1274 The following example creates the CSR and stores it in the keystore indicated
1275 in the command:
1278 .in +2
1280  $ pktool gencsr keystore=nss subject="O=Sun Microsystems Inc., \e
1281        OU=Solaris Security Technologies Group, L=Ashburn, ST=VA, C=US, \e
1282        CN=John Smith" keytype=rsa keylen=2048 outcsr=csr.dat
1284 .in -2
1288 \fBExample 3 \fRImporting a Certificate
1291 The following example imports a certificate object from the specified input
1292 file into the keystore indicated in the command:
1295 .in +2
1297  $ pktool import keystore=nss objtype=cert infile=mycert.pem \e
1298        nickname=mycert
1300 .in -2
1303 .SH EXIT STATUS
1306 The following exit values are returned:
1308 .ne 2
1310 \fB\fB0\fR\fR
1312 .RS 6n
1313 Successful completion.
1317 .ne 2
1319 \fB\fB>0\fR\fR
1321 .RS 6n
1322 An error occurred.
1325 .SH ATTRIBUTES
1328 See \fBattributes\fR(5) for descriptions of the following attributes:
1333 box;
1334 c | c
1335 l | l .
1336 ATTRIBUTE TYPE  ATTRIBUTE VALUE
1338 Interface Stability     Committed
1341 .SH SEE ALSO
1344 \fBattributes\fR(5), \fBpkcs11_softtoken\fR(5)
1347 RSA PKCS#11 v2.11 http://www.rsasecurity.com
1350 RSA PKCS#12 v1.0 http://www.rsasecurity.com