Deleted Added
full compact
pkcs12.1 (110010) pkcs12.1 (110655)
1.\" Automatically generated by Pod::Man version 1.15
1.\" Automatically generated by Pod::Man version 1.15
2.\" Sun Jan 12 18:05:17 2003
2.\" Mon Feb 3 10:00:57 2003
3.\"
4.\" Standard preamble:
5.\" ======================================================================
6.de Sh \" Subsection heading
7.br
8.if t .Sp
9.ne 5
10.PP
11\fB\\$1\fR
12.PP
13..
14.de Sp \" Vertical space (when we can't use .PP)
15.if t .sp .5v
16.if n .sp
17..
18.de Ip \" List item
19.br
20.ie \\n(.$>=3 .ne \\$3
21.el .ne 3
22.IP "\\$1" \\$2
23..
24.de Vb \" Begin verbatim text
25.ft CW
26.nf
27.ne \\$1
28..
29.de Ve \" End verbatim text
30.ft R
31
32.fi
33..
34.\" Set up some character translations and predefined strings. \*(-- will
35.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
36.\" double quote, and \*(R" will give a right double quote. | will give a
37.\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used
38.\" to do unbreakable dashes and therefore won't be available. \*(C` and
39.\" \*(C' expand to `' in nroff, nothing in troff, for use with C<>
40.tr \(*W-|\(bv\*(Tr
41.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
42.ie n \{\
43. ds -- \(*W-
44. ds PI pi
45. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
46. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
47. ds L" ""
48. ds R" ""
49. ds C` ""
50. ds C' ""
51'br\}
52.el\{\
53. ds -- \|\(em\|
54. ds PI \(*p
55. ds L" ``
56. ds R" ''
57'br\}
58.\"
59.\" If the F register is turned on, we'll generate index entries on stderr
60.\" for titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and
61.\" index entries marked with X<> in POD. Of course, you'll have to process
62.\" the output yourself in some meaningful fashion.
63.if \nF \{\
64. de IX
65. tm Index:\\$1\t\\n%\t"\\$2"
66..
67. nr % 0
68. rr F
69.\}
70.\"
71.\" For nroff, turn off justification. Always turn off hyphenation; it
72.\" makes way too many mistakes in technical documents.
73.hy 0
74.if n .na
75.\"
76.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
77.\" Fear. Run. Save yourself. No user-serviceable parts.
78.bd B 3
79. \" fudge factors for nroff and troff
80.if n \{\
81. ds #H 0
82. ds #V .8m
83. ds #F .3m
84. ds #[ \f1
85. ds #] \fP
86.\}
87.if t \{\
88. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
89. ds #V .6m
90. ds #F 0
91. ds #[ \&
92. ds #] \&
93.\}
94. \" simple accents for nroff and troff
95.if n \{\
96. ds ' \&
97. ds ` \&
98. ds ^ \&
99. ds , \&
100. ds ~ ~
101. ds /
102.\}
103.if t \{\
104. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
105. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
106. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
107. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
108. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
109. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
110.\}
111. \" troff and (daisy-wheel) nroff accents
112.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
113.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
114.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
115.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
116.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
117.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
118.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
119.ds ae a\h'-(\w'a'u*4/10)'e
120.ds Ae A\h'-(\w'A'u*4/10)'E
121. \" corrections for vroff
122.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
123.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
124. \" for low resolution devices (crt and lpr)
125.if \n(.H>23 .if \n(.V>19 \
126\{\
127. ds : e
128. ds 8 ss
129. ds o a
130. ds d- d\h'-1'\(ga
131. ds D- D\h'-1'\(hy
132. ds th \o'bp'
133. ds Th \o'LP'
134. ds ae ae
135. ds Ae AE
136.\}
137.rm #[ #] #H #V #F C
138.\" ======================================================================
139.\"
3.\"
4.\" Standard preamble:
5.\" ======================================================================
6.de Sh \" Subsection heading
7.br
8.if t .Sp
9.ne 5
10.PP
11\fB\\$1\fR
12.PP
13..
14.de Sp \" Vertical space (when we can't use .PP)
15.if t .sp .5v
16.if n .sp
17..
18.de Ip \" List item
19.br
20.ie \\n(.$>=3 .ne \\$3
21.el .ne 3
22.IP "\\$1" \\$2
23..
24.de Vb \" Begin verbatim text
25.ft CW
26.nf
27.ne \\$1
28..
29.de Ve \" End verbatim text
30.ft R
31
32.fi
33..
34.\" Set up some character translations and predefined strings. \*(-- will
35.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
36.\" double quote, and \*(R" will give a right double quote. | will give a
37.\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used
38.\" to do unbreakable dashes and therefore won't be available. \*(C` and
39.\" \*(C' expand to `' in nroff, nothing in troff, for use with C<>
40.tr \(*W-|\(bv\*(Tr
41.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
42.ie n \{\
43. ds -- \(*W-
44. ds PI pi
45. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
46. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
47. ds L" ""
48. ds R" ""
49. ds C` ""
50. ds C' ""
51'br\}
52.el\{\
53. ds -- \|\(em\|
54. ds PI \(*p
55. ds L" ``
56. ds R" ''
57'br\}
58.\"
59.\" If the F register is turned on, we'll generate index entries on stderr
60.\" for titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and
61.\" index entries marked with X<> in POD. Of course, you'll have to process
62.\" the output yourself in some meaningful fashion.
63.if \nF \{\
64. de IX
65. tm Index:\\$1\t\\n%\t"\\$2"
66..
67. nr % 0
68. rr F
69.\}
70.\"
71.\" For nroff, turn off justification. Always turn off hyphenation; it
72.\" makes way too many mistakes in technical documents.
73.hy 0
74.if n .na
75.\"
76.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
77.\" Fear. Run. Save yourself. No user-serviceable parts.
78.bd B 3
79. \" fudge factors for nroff and troff
80.if n \{\
81. ds #H 0
82. ds #V .8m
83. ds #F .3m
84. ds #[ \f1
85. ds #] \fP
86.\}
87.if t \{\
88. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
89. ds #V .6m
90. ds #F 0
91. ds #[ \&
92. ds #] \&
93.\}
94. \" simple accents for nroff and troff
95.if n \{\
96. ds ' \&
97. ds ` \&
98. ds ^ \&
99. ds , \&
100. ds ~ ~
101. ds /
102.\}
103.if t \{\
104. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
105. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
106. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
107. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
108. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
109. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
110.\}
111. \" troff and (daisy-wheel) nroff accents
112.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
113.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
114.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
115.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
116.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
117.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
118.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
119.ds ae a\h'-(\w'a'u*4/10)'e
120.ds Ae A\h'-(\w'A'u*4/10)'E
121. \" corrections for vroff
122.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
123.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
124. \" for low resolution devices (crt and lpr)
125.if \n(.H>23 .if \n(.V>19 \
126\{\
127. ds : e
128. ds 8 ss
129. ds o a
130. ds d- d\h'-1'\(ga
131. ds D- D\h'-1'\(hy
132. ds th \o'bp'
133. ds Th \o'LP'
134. ds ae ae
135. ds Ae AE
136.\}
137.rm #[ #] #H #V #F C
138.\" ======================================================================
139.\"
140.IX Title "pkcs12 3"
141.TH pkcs12 3 "0.9.7" "2003-01-12" "OpenSSL"
140.IX Title "PKCS12 1"
141.TH PKCS12 1 "0.9.7" "2003-02-03" "OpenSSL"
142.UC
143.SH "NAME"
144pkcs12 \- PKCS#12 file utility
145.SH "SYNOPSIS"
146.IX Header "SYNOPSIS"
147\&\fBopenssl\fR \fBpkcs12\fR
148[\fB\-export\fR]
149[\fB\-chain\fR]
150[\fB\-inkey filename\fR]
151[\fB\-certfile filename\fR]
152[\fB\-name name\fR]
153[\fB\-caname name\fR]
154[\fB\-in filename\fR]
155[\fB\-out filename\fR]
156[\fB\-noout\fR]
157[\fB\-nomacver\fR]
158[\fB\-nocerts\fR]
159[\fB\-clcerts\fR]
160[\fB\-cacerts\fR]
161[\fB\-nokeys\fR]
162[\fB\-info\fR]
163[\fB\-des\fR]
164[\fB\-des3\fR]
165[\fB\-idea\fR]
166[\fB\-nodes\fR]
167[\fB\-noiter\fR]
168[\fB\-maciter\fR]
169[\fB\-twopass\fR]
170[\fB\-descert\fR]
171[\fB\-certpbe\fR]
172[\fB\-keypbe\fR]
173[\fB\-keyex\fR]
174[\fB\-keysig\fR]
175[\fB\-password arg\fR]
176[\fB\-passin arg\fR]
177[\fB\-passout arg\fR]
178[\fB\-rand \f(BIfile\fB\|(s)\fR]
179.SH "DESCRIPTION"
180.IX Header "DESCRIPTION"
181The \fBpkcs12\fR command allows PKCS#12 files (sometimes referred to as
182\&\s-1PFX\s0 files) to be created and parsed. PKCS#12 files are used by several
183programs including Netscape, \s-1MSIE\s0 and \s-1MS\s0 Outlook.
184.SH "COMMAND OPTIONS"
185.IX Header "COMMAND OPTIONS"
186There are a lot of options the meaning of some depends of whether a PKCS#12 file
187is being created or parsed. By default a PKCS#12 file is parsed a PKCS#12
188file can be created by using the \fB\-export\fR option (see below).
189.SH "PARSING OPTIONS"
190.IX Header "PARSING OPTIONS"
191.Ip "\fB\-in filename\fR" 4
192.IX Item "-in filename"
193This specifies filename of the PKCS#12 file to be parsed. Standard input is used
194by default.
195.Ip "\fB\-out filename\fR" 4
196.IX Item "-out filename"
197The filename to write certificates and private keys to, standard output by default.
198They are all written in \s-1PEM\s0 format.
199.Ip "\fB\-pass arg\fR, \fB\-passin arg\fR" 4
200.IX Item "-pass arg, -passin arg"
201the PKCS#12 file (i.e. input file) password source. For more information about the
202format of \fBarg\fR see the \fB\s-1PASS\s0 \s-1PHRASE\s0 \s-1ARGUMENTS\s0\fR section in
203openssl(1).
204.Ip "\fB\-passout arg\fR" 4
205.IX Item "-passout arg"
206pass phrase source to encrypt any outputed private keys with. For more information
207about the format of \fBarg\fR see the \fB\s-1PASS\s0 \s-1PHRASE\s0 \s-1ARGUMENTS\s0\fR section in
208openssl(1).
209.Ip "\fB\-noout\fR" 4
210.IX Item "-noout"
211this option inhibits output of the keys and certificates to the output file version
212of the PKCS#12 file.
213.Ip "\fB\-clcerts\fR" 4
214.IX Item "-clcerts"
215only output client certificates (not \s-1CA\s0 certificates).
216.Ip "\fB\-cacerts\fR" 4
217.IX Item "-cacerts"
218only output \s-1CA\s0 certificates (not client certificates).
219.Ip "\fB\-nocerts\fR" 4
220.IX Item "-nocerts"
221no certificates at all will be output.
222.Ip "\fB\-nokeys\fR" 4
223.IX Item "-nokeys"
224no private keys will be output.
225.Ip "\fB\-info\fR" 4
226.IX Item "-info"
227output additional information about the PKCS#12 file structure, algorithms used and
228iteration counts.
229.Ip "\fB\-des\fR" 4
230.IX Item "-des"
231use \s-1DES\s0 to encrypt private keys before outputting.
232.Ip "\fB\-des3\fR" 4
233.IX Item "-des3"
234use triple \s-1DES\s0 to encrypt private keys before outputting, this is the default.
235.Ip "\fB\-idea\fR" 4
236.IX Item "-idea"
237use \s-1IDEA\s0 to encrypt private keys before outputting.
238.Ip "\fB\-nodes\fR" 4
239.IX Item "-nodes"
240don't encrypt the private keys at all.
241.Ip "\fB\-nomacver\fR" 4
242.IX Item "-nomacver"
243don't attempt to verify the integrity \s-1MAC\s0 before reading the file.
244.Ip "\fB\-twopass\fR" 4
245.IX Item "-twopass"
246prompt for separate integrity and encryption passwords: most software
247always assumes these are the same so this option will render such
248PKCS#12 files unreadable.
249.SH "FILE CREATION OPTIONS"
250.IX Header "FILE CREATION OPTIONS"
251.Ip "\fB\-export\fR" 4
252.IX Item "-export"
253This option specifies that a PKCS#12 file will be created rather than
254parsed.
255.Ip "\fB\-out filename\fR" 4
256.IX Item "-out filename"
257This specifies filename to write the PKCS#12 file to. Standard output is used
258by default.
259.Ip "\fB\-in filename\fR" 4
260.IX Item "-in filename"
261The filename to read certificates and private keys from, standard input by default.
262They must all be in \s-1PEM\s0 format. The order doesn't matter but one private key and
263its corresponding certificate should be present. If additional certificates are
264present they will also be included in the PKCS#12 file.
265.Ip "\fB\-inkey filename\fR" 4
266.IX Item "-inkey filename"
267file to read private key from. If not present then a private key must be present
268in the input file.
269.Ip "\fB\-name friendlyname\fR" 4
270.IX Item "-name friendlyname"
271This specifies the \*(L"friendly name\*(R" for the certificate and private key. This name
272is typically displayed in list boxes by software importing the file.
273.Ip "\fB\-certfile filename\fR" 4
274.IX Item "-certfile filename"
275A filename to read additional certificates from.
276.Ip "\fB\-caname friendlyname\fR" 4
277.IX Item "-caname friendlyname"
278This specifies the \*(L"friendly name\*(R" for other certificates. This option may be
279used multiple times to specify names for all certificates in the order they
280appear. Netscape ignores friendly names on other certificates whereas \s-1MSIE\s0
281displays them.
282.Ip "\fB\-pass arg\fR, \fB\-passout arg\fR" 4
283.IX Item "-pass arg, -passout arg"
284the PKCS#12 file (i.e. output file) password source. For more information about
285the format of \fBarg\fR see the \fB\s-1PASS\s0 \s-1PHRASE\s0 \s-1ARGUMENTS\s0\fR section in
286openssl(1).
287.Ip "\fB\-passin password\fR" 4
288.IX Item "-passin password"
289pass phrase source to decrypt any input private keys with. For more information
290about the format of \fBarg\fR see the \fB\s-1PASS\s0 \s-1PHRASE\s0 \s-1ARGUMENTS\s0\fR section in
291openssl(1).
292.Ip "\fB\-chain\fR" 4
293.IX Item "-chain"
294if this option is present then an attempt is made to include the entire
295certificate chain of the user certificate. The standard \s-1CA\s0 store is used
296for this search. If the search fails it is considered a fatal error.
297.Ip "\fB\-descert\fR" 4
298.IX Item "-descert"
299encrypt the certificate using triple \s-1DES\s0, this may render the PKCS#12
300file unreadable by some \*(L"export grade\*(R" software. By default the private
301key is encrypted using triple \s-1DES\s0 and the certificate using 40 bit \s-1RC2\s0.
302.Ip "\fB\-keypbe alg\fR, \fB\-certpbe alg\fR" 4
303.IX Item "-keypbe alg, -certpbe alg"
304these options allow the algorithm used to encrypt the private key and
305certificates to be selected. Although any PKCS#5 v1.5 or PKCS#12 algorithms
306can be selected it is advisable only to use PKCS#12 algorithms. See the list
307in the \fB\s-1NOTES\s0\fR section for more information.
308.Ip "\fB\-keyex|\-keysig\fR" 4
309.IX Item "-keyex|-keysig"
310specifies that the private key is to be used for key exchange or just signing.
311This option is only interpreted by \s-1MSIE\s0 and similar \s-1MS\s0 software. Normally
312\&\*(L"export grade\*(R" software will only allow 512 bit \s-1RSA\s0 keys to be used for
313encryption purposes but arbitrary length keys for signing. The \fB\-keysig\fR
314option marks the key for signing only. Signing only keys can be used for
315S/MIME signing, authenticode (ActiveX control signing) and \s-1SSL\s0 client
316authentication, however due to a bug only \s-1MSIE\s0 5.0 and later support
317the use of signing only keys for \s-1SSL\s0 client authentication.
318.Ip "\fB\-nomaciter\fR, \fB\-noiter\fR" 4
319.IX Item "-nomaciter, -noiter"
320these options affect the iteration counts on the \s-1MAC\s0 and key algorithms.
321Unless you wish to produce files compatible with \s-1MSIE\s0 4.0 you should leave
322these options alone.
323.Sp
324To discourage attacks by using large dictionaries of common passwords the
325algorithm that derives keys from passwords can have an iteration count applied
326to it: this causes a certain part of the algorithm to be repeated and slows it
327down. The \s-1MAC\s0 is used to check the file integrity but since it will normally
328have the same password as the keys and certificates it could also be attacked.
329By default both \s-1MAC\s0 and encryption iteration counts are set to 2048, using
330these options the \s-1MAC\s0 and encryption iteration counts can be set to 1, since
331this reduces the file security you should not use these options unless you
332really have to. Most software supports both \s-1MAC\s0 and key iteration counts.
333\&\s-1MSIE\s0 4.0 doesn't support \s-1MAC\s0 iteration counts so it needs the \fB\-nomaciter\fR
334option.
335.Ip "\fB\-maciter\fR" 4
336.IX Item "-maciter"
337This option is included for compatibility with previous versions, it used
338to be needed to use \s-1MAC\s0 iterations counts but they are now used by default.
339.Ip "\fB\-rand \f(BIfile\fB\|(s)\fR" 4
340.IX Item "-rand file"
341a file or files containing random data used to seed the random number
342generator, or an \s-1EGD\s0 socket (see RAND_egd(3)).
343Multiple files can be specified separated by a OS-dependent character.
344The separator is \fB;\fR for MS-Windows, \fB,\fR for OpenVMS, and \fB:\fR for
345all others.
346.SH "NOTES"
347.IX Header "NOTES"
348Although there are a large number of options most of them are very rarely
349used. For PKCS#12 file parsing only \fB\-in\fR and \fB\-out\fR need to be used
350for PKCS#12 file creation \fB\-export\fR and \fB\-name\fR are also used.
351.PP
352If none of the \fB\-clcerts\fR, \fB\-cacerts\fR or \fB\-nocerts\fR options are present
353then all certificates will be output in the order they appear in the input
354PKCS#12 files. There is no guarantee that the first certificate present is
355the one corresponding to the private key. Certain software which requires
356a private key and certificate and assumes the first certificate in the
357file is the one corresponding to the private key: this may not always
358be the case. Using the \fB\-clcerts\fR option will solve this problem by only
359outputting the certificate corresponding to the private key. If the \s-1CA\s0
360certificates are required then they can be output to a separate file using
361the \fB\-nokeys \-cacerts\fR options to just output \s-1CA\s0 certificates.
362.PP
363The \fB\-keypbe\fR and \fB\-certpbe\fR algorithms allow the precise encryption
364algorithms for private keys and certificates to be specified. Normally
365the defaults are fine but occasionally software can't handle triple \s-1DES\s0
366encrypted private keys, then the option \fB\-keypbe \s-1PBE-SHA1\-RC2\-40\s0\fR can
367be used to reduce the private key encryption to 40 bit \s-1RC2\s0. A complete
368description of all algorithms is contained in the \fBpkcs8\fR manual page.
369.SH "EXAMPLES"
370.IX Header "EXAMPLES"
371Parse a PKCS#12 file and output it to a file:
372.PP
373.Vb 1
374\& openssl pkcs12 -in file.p12 -out file.pem
375.Ve
376Output only client certificates to a file:
377.PP
378.Vb 1
379\& openssl pkcs12 -in file.p12 -clcerts -out file.pem
380.Ve
381Don't encrypt the private key:
382.PP
383.Vb 1
384\& openssl pkcs12 -in file.p12 -out file.pem -nodes
385.Ve
386Print some info about a PKCS#12 file:
387.PP
388.Vb 1
389\& openssl pkcs12 -in file.p12 -info -noout
390.Ve
391Create a PKCS#12 file:
392.PP
393.Vb 1
394\& openssl pkcs12 -export -in file.pem -out file.p12 -name "My Certificate"
395.Ve
396Include some extra certificates:
397.PP
398.Vb 2
399\& openssl pkcs12 -export -in file.pem -out file.p12 -name "My Certificate" \e
400\& -certfile othercerts.pem
401.Ve
402.SH "BUGS"
403.IX Header "BUGS"
404Some would argue that the PKCS#12 standard is one big bug :\-)
405.PP
406Versions of OpenSSL before 0.9.6a had a bug in the PKCS#12 key generation
407routines. Under rare circumstances this could produce a PKCS#12 file encrypted
408with an invalid key. As a result some PKCS#12 files which triggered this bug
409from other implementations (\s-1MSIE\s0 or Netscape) could not be decrypted
410by OpenSSL and similarly OpenSSL could produce PKCS#12 files which could
411not be decrypted by other implementations. The chances of producing such
412a file are relatively small: less than 1 in 256.
413.PP
414A side effect of fixing this bug is that any old invalidly encrypted PKCS#12
415files cannot no longer be parsed by the fixed version. Under such circumstances
416the \fBpkcs12\fR utility will report that the \s-1MAC\s0 is \s-1OK\s0 but fail with a decryption
417error when extracting private keys.
418.PP
419This problem can be resolved by extracting the private keys and certificates
420from the PKCS#12 file using an older version of OpenSSL and recreating the PKCS#12
421file from the keys and certificates using a newer version of OpenSSL. For example:
422.PP
423.Vb 2
424\& old-openssl -in bad.p12 -out keycerts.pem
425\& openssl -in keycerts.pem -export -name "My PKCS#12 file" -out fixed.p12
426.Ve
427.SH "SEE ALSO"
428.IX Header "SEE ALSO"
429pkcs8(1)
142.UC
143.SH "NAME"
144pkcs12 \- PKCS#12 file utility
145.SH "SYNOPSIS"
146.IX Header "SYNOPSIS"
147\&\fBopenssl\fR \fBpkcs12\fR
148[\fB\-export\fR]
149[\fB\-chain\fR]
150[\fB\-inkey filename\fR]
151[\fB\-certfile filename\fR]
152[\fB\-name name\fR]
153[\fB\-caname name\fR]
154[\fB\-in filename\fR]
155[\fB\-out filename\fR]
156[\fB\-noout\fR]
157[\fB\-nomacver\fR]
158[\fB\-nocerts\fR]
159[\fB\-clcerts\fR]
160[\fB\-cacerts\fR]
161[\fB\-nokeys\fR]
162[\fB\-info\fR]
163[\fB\-des\fR]
164[\fB\-des3\fR]
165[\fB\-idea\fR]
166[\fB\-nodes\fR]
167[\fB\-noiter\fR]
168[\fB\-maciter\fR]
169[\fB\-twopass\fR]
170[\fB\-descert\fR]
171[\fB\-certpbe\fR]
172[\fB\-keypbe\fR]
173[\fB\-keyex\fR]
174[\fB\-keysig\fR]
175[\fB\-password arg\fR]
176[\fB\-passin arg\fR]
177[\fB\-passout arg\fR]
178[\fB\-rand \f(BIfile\fB\|(s)\fR]
179.SH "DESCRIPTION"
180.IX Header "DESCRIPTION"
181The \fBpkcs12\fR command allows PKCS#12 files (sometimes referred to as
182\&\s-1PFX\s0 files) to be created and parsed. PKCS#12 files are used by several
183programs including Netscape, \s-1MSIE\s0 and \s-1MS\s0 Outlook.
184.SH "COMMAND OPTIONS"
185.IX Header "COMMAND OPTIONS"
186There are a lot of options the meaning of some depends of whether a PKCS#12 file
187is being created or parsed. By default a PKCS#12 file is parsed a PKCS#12
188file can be created by using the \fB\-export\fR option (see below).
189.SH "PARSING OPTIONS"
190.IX Header "PARSING OPTIONS"
191.Ip "\fB\-in filename\fR" 4
192.IX Item "-in filename"
193This specifies filename of the PKCS#12 file to be parsed. Standard input is used
194by default.
195.Ip "\fB\-out filename\fR" 4
196.IX Item "-out filename"
197The filename to write certificates and private keys to, standard output by default.
198They are all written in \s-1PEM\s0 format.
199.Ip "\fB\-pass arg\fR, \fB\-passin arg\fR" 4
200.IX Item "-pass arg, -passin arg"
201the PKCS#12 file (i.e. input file) password source. For more information about the
202format of \fBarg\fR see the \fB\s-1PASS\s0 \s-1PHRASE\s0 \s-1ARGUMENTS\s0\fR section in
203openssl(1).
204.Ip "\fB\-passout arg\fR" 4
205.IX Item "-passout arg"
206pass phrase source to encrypt any outputed private keys with. For more information
207about the format of \fBarg\fR see the \fB\s-1PASS\s0 \s-1PHRASE\s0 \s-1ARGUMENTS\s0\fR section in
208openssl(1).
209.Ip "\fB\-noout\fR" 4
210.IX Item "-noout"
211this option inhibits output of the keys and certificates to the output file version
212of the PKCS#12 file.
213.Ip "\fB\-clcerts\fR" 4
214.IX Item "-clcerts"
215only output client certificates (not \s-1CA\s0 certificates).
216.Ip "\fB\-cacerts\fR" 4
217.IX Item "-cacerts"
218only output \s-1CA\s0 certificates (not client certificates).
219.Ip "\fB\-nocerts\fR" 4
220.IX Item "-nocerts"
221no certificates at all will be output.
222.Ip "\fB\-nokeys\fR" 4
223.IX Item "-nokeys"
224no private keys will be output.
225.Ip "\fB\-info\fR" 4
226.IX Item "-info"
227output additional information about the PKCS#12 file structure, algorithms used and
228iteration counts.
229.Ip "\fB\-des\fR" 4
230.IX Item "-des"
231use \s-1DES\s0 to encrypt private keys before outputting.
232.Ip "\fB\-des3\fR" 4
233.IX Item "-des3"
234use triple \s-1DES\s0 to encrypt private keys before outputting, this is the default.
235.Ip "\fB\-idea\fR" 4
236.IX Item "-idea"
237use \s-1IDEA\s0 to encrypt private keys before outputting.
238.Ip "\fB\-nodes\fR" 4
239.IX Item "-nodes"
240don't encrypt the private keys at all.
241.Ip "\fB\-nomacver\fR" 4
242.IX Item "-nomacver"
243don't attempt to verify the integrity \s-1MAC\s0 before reading the file.
244.Ip "\fB\-twopass\fR" 4
245.IX Item "-twopass"
246prompt for separate integrity and encryption passwords: most software
247always assumes these are the same so this option will render such
248PKCS#12 files unreadable.
249.SH "FILE CREATION OPTIONS"
250.IX Header "FILE CREATION OPTIONS"
251.Ip "\fB\-export\fR" 4
252.IX Item "-export"
253This option specifies that a PKCS#12 file will be created rather than
254parsed.
255.Ip "\fB\-out filename\fR" 4
256.IX Item "-out filename"
257This specifies filename to write the PKCS#12 file to. Standard output is used
258by default.
259.Ip "\fB\-in filename\fR" 4
260.IX Item "-in filename"
261The filename to read certificates and private keys from, standard input by default.
262They must all be in \s-1PEM\s0 format. The order doesn't matter but one private key and
263its corresponding certificate should be present. If additional certificates are
264present they will also be included in the PKCS#12 file.
265.Ip "\fB\-inkey filename\fR" 4
266.IX Item "-inkey filename"
267file to read private key from. If not present then a private key must be present
268in the input file.
269.Ip "\fB\-name friendlyname\fR" 4
270.IX Item "-name friendlyname"
271This specifies the \*(L"friendly name\*(R" for the certificate and private key. This name
272is typically displayed in list boxes by software importing the file.
273.Ip "\fB\-certfile filename\fR" 4
274.IX Item "-certfile filename"
275A filename to read additional certificates from.
276.Ip "\fB\-caname friendlyname\fR" 4
277.IX Item "-caname friendlyname"
278This specifies the \*(L"friendly name\*(R" for other certificates. This option may be
279used multiple times to specify names for all certificates in the order they
280appear. Netscape ignores friendly names on other certificates whereas \s-1MSIE\s0
281displays them.
282.Ip "\fB\-pass arg\fR, \fB\-passout arg\fR" 4
283.IX Item "-pass arg, -passout arg"
284the PKCS#12 file (i.e. output file) password source. For more information about
285the format of \fBarg\fR see the \fB\s-1PASS\s0 \s-1PHRASE\s0 \s-1ARGUMENTS\s0\fR section in
286openssl(1).
287.Ip "\fB\-passin password\fR" 4
288.IX Item "-passin password"
289pass phrase source to decrypt any input private keys with. For more information
290about the format of \fBarg\fR see the \fB\s-1PASS\s0 \s-1PHRASE\s0 \s-1ARGUMENTS\s0\fR section in
291openssl(1).
292.Ip "\fB\-chain\fR" 4
293.IX Item "-chain"
294if this option is present then an attempt is made to include the entire
295certificate chain of the user certificate. The standard \s-1CA\s0 store is used
296for this search. If the search fails it is considered a fatal error.
297.Ip "\fB\-descert\fR" 4
298.IX Item "-descert"
299encrypt the certificate using triple \s-1DES\s0, this may render the PKCS#12
300file unreadable by some \*(L"export grade\*(R" software. By default the private
301key is encrypted using triple \s-1DES\s0 and the certificate using 40 bit \s-1RC2\s0.
302.Ip "\fB\-keypbe alg\fR, \fB\-certpbe alg\fR" 4
303.IX Item "-keypbe alg, -certpbe alg"
304these options allow the algorithm used to encrypt the private key and
305certificates to be selected. Although any PKCS#5 v1.5 or PKCS#12 algorithms
306can be selected it is advisable only to use PKCS#12 algorithms. See the list
307in the \fB\s-1NOTES\s0\fR section for more information.
308.Ip "\fB\-keyex|\-keysig\fR" 4
309.IX Item "-keyex|-keysig"
310specifies that the private key is to be used for key exchange or just signing.
311This option is only interpreted by \s-1MSIE\s0 and similar \s-1MS\s0 software. Normally
312\&\*(L"export grade\*(R" software will only allow 512 bit \s-1RSA\s0 keys to be used for
313encryption purposes but arbitrary length keys for signing. The \fB\-keysig\fR
314option marks the key for signing only. Signing only keys can be used for
315S/MIME signing, authenticode (ActiveX control signing) and \s-1SSL\s0 client
316authentication, however due to a bug only \s-1MSIE\s0 5.0 and later support
317the use of signing only keys for \s-1SSL\s0 client authentication.
318.Ip "\fB\-nomaciter\fR, \fB\-noiter\fR" 4
319.IX Item "-nomaciter, -noiter"
320these options affect the iteration counts on the \s-1MAC\s0 and key algorithms.
321Unless you wish to produce files compatible with \s-1MSIE\s0 4.0 you should leave
322these options alone.
323.Sp
324To discourage attacks by using large dictionaries of common passwords the
325algorithm that derives keys from passwords can have an iteration count applied
326to it: this causes a certain part of the algorithm to be repeated and slows it
327down. The \s-1MAC\s0 is used to check the file integrity but since it will normally
328have the same password as the keys and certificates it could also be attacked.
329By default both \s-1MAC\s0 and encryption iteration counts are set to 2048, using
330these options the \s-1MAC\s0 and encryption iteration counts can be set to 1, since
331this reduces the file security you should not use these options unless you
332really have to. Most software supports both \s-1MAC\s0 and key iteration counts.
333\&\s-1MSIE\s0 4.0 doesn't support \s-1MAC\s0 iteration counts so it needs the \fB\-nomaciter\fR
334option.
335.Ip "\fB\-maciter\fR" 4
336.IX Item "-maciter"
337This option is included for compatibility with previous versions, it used
338to be needed to use \s-1MAC\s0 iterations counts but they are now used by default.
339.Ip "\fB\-rand \f(BIfile\fB\|(s)\fR" 4
340.IX Item "-rand file"
341a file or files containing random data used to seed the random number
342generator, or an \s-1EGD\s0 socket (see RAND_egd(3)).
343Multiple files can be specified separated by a OS-dependent character.
344The separator is \fB;\fR for MS-Windows, \fB,\fR for OpenVMS, and \fB:\fR for
345all others.
346.SH "NOTES"
347.IX Header "NOTES"
348Although there are a large number of options most of them are very rarely
349used. For PKCS#12 file parsing only \fB\-in\fR and \fB\-out\fR need to be used
350for PKCS#12 file creation \fB\-export\fR and \fB\-name\fR are also used.
351.PP
352If none of the \fB\-clcerts\fR, \fB\-cacerts\fR or \fB\-nocerts\fR options are present
353then all certificates will be output in the order they appear in the input
354PKCS#12 files. There is no guarantee that the first certificate present is
355the one corresponding to the private key. Certain software which requires
356a private key and certificate and assumes the first certificate in the
357file is the one corresponding to the private key: this may not always
358be the case. Using the \fB\-clcerts\fR option will solve this problem by only
359outputting the certificate corresponding to the private key. If the \s-1CA\s0
360certificates are required then they can be output to a separate file using
361the \fB\-nokeys \-cacerts\fR options to just output \s-1CA\s0 certificates.
362.PP
363The \fB\-keypbe\fR and \fB\-certpbe\fR algorithms allow the precise encryption
364algorithms for private keys and certificates to be specified. Normally
365the defaults are fine but occasionally software can't handle triple \s-1DES\s0
366encrypted private keys, then the option \fB\-keypbe \s-1PBE-SHA1\-RC2\-40\s0\fR can
367be used to reduce the private key encryption to 40 bit \s-1RC2\s0. A complete
368description of all algorithms is contained in the \fBpkcs8\fR manual page.
369.SH "EXAMPLES"
370.IX Header "EXAMPLES"
371Parse a PKCS#12 file and output it to a file:
372.PP
373.Vb 1
374\& openssl pkcs12 -in file.p12 -out file.pem
375.Ve
376Output only client certificates to a file:
377.PP
378.Vb 1
379\& openssl pkcs12 -in file.p12 -clcerts -out file.pem
380.Ve
381Don't encrypt the private key:
382.PP
383.Vb 1
384\& openssl pkcs12 -in file.p12 -out file.pem -nodes
385.Ve
386Print some info about a PKCS#12 file:
387.PP
388.Vb 1
389\& openssl pkcs12 -in file.p12 -info -noout
390.Ve
391Create a PKCS#12 file:
392.PP
393.Vb 1
394\& openssl pkcs12 -export -in file.pem -out file.p12 -name "My Certificate"
395.Ve
396Include some extra certificates:
397.PP
398.Vb 2
399\& openssl pkcs12 -export -in file.pem -out file.p12 -name "My Certificate" \e
400\& -certfile othercerts.pem
401.Ve
402.SH "BUGS"
403.IX Header "BUGS"
404Some would argue that the PKCS#12 standard is one big bug :\-)
405.PP
406Versions of OpenSSL before 0.9.6a had a bug in the PKCS#12 key generation
407routines. Under rare circumstances this could produce a PKCS#12 file encrypted
408with an invalid key. As a result some PKCS#12 files which triggered this bug
409from other implementations (\s-1MSIE\s0 or Netscape) could not be decrypted
410by OpenSSL and similarly OpenSSL could produce PKCS#12 files which could
411not be decrypted by other implementations. The chances of producing such
412a file are relatively small: less than 1 in 256.
413.PP
414A side effect of fixing this bug is that any old invalidly encrypted PKCS#12
415files cannot no longer be parsed by the fixed version. Under such circumstances
416the \fBpkcs12\fR utility will report that the \s-1MAC\s0 is \s-1OK\s0 but fail with a decryption
417error when extracting private keys.
418.PP
419This problem can be resolved by extracting the private keys and certificates
420from the PKCS#12 file using an older version of OpenSSL and recreating the PKCS#12
421file from the keys and certificates using a newer version of OpenSSL. For example:
422.PP
423.Vb 2
424\& old-openssl -in bad.p12 -out keycerts.pem
425\& openssl -in keycerts.pem -export -name "My PKCS#12 file" -out fixed.p12
426.Ve
427.SH "SEE ALSO"
428.IX Header "SEE ALSO"
429pkcs8(1)