xref: /freebsd/crypto/openssl/doc/man1/openssl-pkcs12.pod.in (revision b077aed33b7b6aefca7b17ddb250cf521f938613)
1*b077aed3SPierre Pronchery=pod
2*b077aed3SPierre Pronchery{- OpenSSL::safe::output_do_not_edit_headers(); -}
3*b077aed3SPierre Pronchery
4*b077aed3SPierre Pronchery=head1 NAME
5*b077aed3SPierre Pronchery
6*b077aed3SPierre Proncheryopenssl-pkcs12 - PKCS#12 file command
7*b077aed3SPierre Pronchery
8*b077aed3SPierre Pronchery=head1 SYNOPSIS
9*b077aed3SPierre Pronchery
10*b077aed3SPierre ProncheryB<openssl> B<pkcs12>
11*b077aed3SPierre Pronchery[B<-help>]
12*b077aed3SPierre Pronchery[B<-passin> I<arg>]
13*b077aed3SPierre Pronchery[B<-passout> I<arg>]
14*b077aed3SPierre Pronchery[B<-password> I<arg>]
15*b077aed3SPierre Pronchery[B<-twopass>]
16*b077aed3SPierre Pronchery[B<-in> I<filename>|I<uri>]
17*b077aed3SPierre Pronchery[B<-out> I<filename>]
18*b077aed3SPierre Pronchery[B<-nokeys>]
19*b077aed3SPierre Pronchery[B<-nocerts>]
20*b077aed3SPierre Pronchery[B<-noout>]
21*b077aed3SPierre Pronchery[B<-legacy>]
22*b077aed3SPierre Pronchery{- $OpenSSL::safe::opt_engine_synopsis -}{- $OpenSSL::safe::opt_provider_synopsis -}
23*b077aed3SPierre Pronchery{- $OpenSSL::safe::opt_r_synopsis -}
24*b077aed3SPierre Pronchery
25*b077aed3SPierre ProncheryPKCS#12 input (parsing) options:
26*b077aed3SPierre Pronchery[B<-info>]
27*b077aed3SPierre Pronchery[B<-nomacver>]
28*b077aed3SPierre Pronchery[B<-clcerts>]
29*b077aed3SPierre Pronchery[B<-cacerts>]
30*b077aed3SPierre Pronchery
31*b077aed3SPierre Pronchery[B<-aes128>]
32*b077aed3SPierre Pronchery[B<-aes192>]
33*b077aed3SPierre Pronchery[B<-aes256>]
34*b077aed3SPierre Pronchery[B<-aria128>]
35*b077aed3SPierre Pronchery[B<-aria192>]
36*b077aed3SPierre Pronchery[B<-aria256>]
37*b077aed3SPierre Pronchery[B<-camellia128>]
38*b077aed3SPierre Pronchery[B<-camellia192>]
39*b077aed3SPierre Pronchery[B<-camellia256>]
40*b077aed3SPierre Pronchery[B<-des>]
41*b077aed3SPierre Pronchery[B<-des3>]
42*b077aed3SPierre Pronchery[B<-idea>]
43*b077aed3SPierre Pronchery[B<-noenc>]
44*b077aed3SPierre Pronchery[B<-nodes>]
45*b077aed3SPierre Pronchery
46*b077aed3SPierre ProncheryPKCS#12 output (export) options:
47*b077aed3SPierre Pronchery
48*b077aed3SPierre Pronchery[B<-export>]
49*b077aed3SPierre Pronchery[B<-inkey> I<filename>|I<uri>]
50*b077aed3SPierre Pronchery[B<-certfile> I<filename>]
51*b077aed3SPierre Pronchery[B<-passcerts> I<arg>]
52*b077aed3SPierre Pronchery[B<-chain>]
53*b077aed3SPierre Pronchery[B<-untrusted> I<filename>]
54*b077aed3SPierre Pronchery{- $OpenSSL::safe::opt_trust_synopsis -}
55*b077aed3SPierre Pronchery[B<-name> I<name>]
56*b077aed3SPierre Pronchery[B<-caname> I<name>]
57*b077aed3SPierre Pronchery[B<-CSP> I<name>]
58*b077aed3SPierre Pronchery[B<-LMK>]
59*b077aed3SPierre Pronchery[B<-keyex>]
60*b077aed3SPierre Pronchery[B<-keysig>]
61*b077aed3SPierre Pronchery[B<-keypbe> I<cipher>]
62*b077aed3SPierre Pronchery[B<-certpbe> I<cipher>]
63*b077aed3SPierre Pronchery[B<-descert>]
64*b077aed3SPierre Pronchery[B<-macalg> I<digest>]
65*b077aed3SPierre Pronchery[B<-iter> I<count>]
66*b077aed3SPierre Pronchery[B<-noiter>]
67*b077aed3SPierre Pronchery[B<-nomaciter>]
68*b077aed3SPierre Pronchery[B<-maciter>]
69*b077aed3SPierre Pronchery[B<-nomac>]
70*b077aed3SPierre Pronchery
71*b077aed3SPierre Pronchery=head1 DESCRIPTION
72*b077aed3SPierre Pronchery
73*b077aed3SPierre ProncheryThis command allows PKCS#12 files (sometimes referred to as
74*b077aed3SPierre ProncheryPFX files) to be created and parsed. PKCS#12 files are used by several
75*b077aed3SPierre Proncheryprograms including Netscape, MSIE and MS Outlook.
76*b077aed3SPierre Pronchery
77*b077aed3SPierre Pronchery=head1 OPTIONS
78*b077aed3SPierre Pronchery
79*b077aed3SPierre ProncheryThere are a lot of options the meaning of some depends of whether a PKCS#12 file
80*b077aed3SPierre Proncheryis being created or parsed. By default a PKCS#12 file is parsed.
81*b077aed3SPierre ProncheryA PKCS#12 file can be created by using the B<-export> option (see below).
82*b077aed3SPierre ProncheryThe PKCS#12 export encryption and MAC options such as B<-certpbe> and B<-iter>
83*b077aed3SPierre Proncheryand many further options such as B<-chain> are relevant only with B<-export>.
84*b077aed3SPierre ProncheryConversely, the options regarding encryption of private keys when outputting
85*b077aed3SPierre ProncheryPKCS#12 input are relevant only when the B<-export> option is not given.
86*b077aed3SPierre Pronchery
87*b077aed3SPierre ProncheryThe default encryption algorithm is AES-256-CBC with PBKDF2 for key derivation.
88*b077aed3SPierre Pronchery
89*b077aed3SPierre ProncheryWhen encountering problems loading legacy PKCS#12 files that involve,
90*b077aed3SPierre Proncheryfor example, RC2-40-CBC,
91*b077aed3SPierre Proncherytry using the B<-legacy> option and, if needed, the B<-provider-path> option.
92*b077aed3SPierre Pronchery
93*b077aed3SPierre Pronchery=over 4
94*b077aed3SPierre Pronchery
95*b077aed3SPierre Pronchery=item B<-help>
96*b077aed3SPierre Pronchery
97*b077aed3SPierre ProncheryPrint out a usage message.
98*b077aed3SPierre Pronchery
99*b077aed3SPierre Pronchery=item B<-passin> I<arg>
100*b077aed3SPierre Pronchery
101*b077aed3SPierre ProncheryThe password source for the input, and for encrypting any private keys that
102*b077aed3SPierre Proncheryare output.
103*b077aed3SPierre ProncheryFor more information about the format of B<arg>
104*b077aed3SPierre Proncherysee L<openssl-passphrase-options(1)>.
105*b077aed3SPierre Pronchery
106*b077aed3SPierre Pronchery=item B<-passout> I<arg>
107*b077aed3SPierre Pronchery
108*b077aed3SPierre ProncheryThe password source for output files.
109*b077aed3SPierre Pronchery
110*b077aed3SPierre Pronchery=item B<-password> I<arg>
111*b077aed3SPierre Pronchery
112*b077aed3SPierre ProncheryWith B<-export>, B<-password> is equivalent to B<-passout>,
113*b077aed3SPierre Proncheryotherwise it is equivalent to B<-passin>.
114*b077aed3SPierre Pronchery
115*b077aed3SPierre Pronchery=item B<-twopass>
116*b077aed3SPierre Pronchery
117*b077aed3SPierre ProncheryPrompt for separate integrity and encryption passwords: most software
118*b077aed3SPierre Proncheryalways assumes these are the same so this option will render such
119*b077aed3SPierre ProncheryPKCS#12 files unreadable. Cannot be used in combination with the options
120*b077aed3SPierre ProncheryB<-password>, B<-passin> if importing from PKCS#12, or B<-passout> if exporting.
121*b077aed3SPierre Pronchery
122*b077aed3SPierre Pronchery=item B<-nokeys>
123*b077aed3SPierre Pronchery
124*b077aed3SPierre ProncheryNo private keys will be output.
125*b077aed3SPierre Pronchery
126*b077aed3SPierre Pronchery=item B<-nocerts>
127*b077aed3SPierre Pronchery
128*b077aed3SPierre ProncheryNo certificates will be output.
129*b077aed3SPierre Pronchery
130*b077aed3SPierre Pronchery=item B<-noout>
131*b077aed3SPierre Pronchery
132*b077aed3SPierre ProncheryThis option inhibits all credentials output,
133*b077aed3SPierre Proncheryand so the input is just verified.
134*b077aed3SPierre Pronchery
135*b077aed3SPierre Pronchery=item B<-legacy>
136*b077aed3SPierre Pronchery
137*b077aed3SPierre ProncheryUse legacy mode of operation and automatically load the legacy provider.
138*b077aed3SPierre ProncheryIf OpenSSL is not installed system-wide,
139*b077aed3SPierre Proncheryit is necessary to also use, for example, C<-provider-path ./providers>
140*b077aed3SPierre Proncheryor to set the environment variable B<OPENSSL_MODULES>
141*b077aed3SPierre Proncheryto point to the directory where the providers can be found.
142*b077aed3SPierre Pronchery
143*b077aed3SPierre ProncheryIn the legacy mode, the default algorithm for certificate encryption
144*b077aed3SPierre Proncheryis RC2_CBC or 3DES_CBC depending on whether the RC2 cipher is enabled
145*b077aed3SPierre Proncheryin the build. The default algorithm for private key encryption is 3DES_CBC.
146*b077aed3SPierre ProncheryIf the legacy option is not specified, then the legacy provider is not loaded
147*b077aed3SPierre Proncheryand the default encryption algorithm for both certificates and private keys is
148*b077aed3SPierre ProncheryAES_256_CBC with PBKDF2 for key derivation.
149*b077aed3SPierre Pronchery
150*b077aed3SPierre Pronchery{- $OpenSSL::safe::opt_engine_item -}
151*b077aed3SPierre Pronchery
152*b077aed3SPierre Pronchery{- $OpenSSL::safe::opt_provider_item -}
153*b077aed3SPierre Pronchery
154*b077aed3SPierre Pronchery{- $OpenSSL::safe::opt_r_item -}
155*b077aed3SPierre Pronchery
156*b077aed3SPierre Pronchery=back
157*b077aed3SPierre Pronchery
158*b077aed3SPierre Pronchery=head2 PKCS#12 input (parsing) options
159*b077aed3SPierre Pronchery
160*b077aed3SPierre Pronchery=over 4
161*b077aed3SPierre Pronchery
162*b077aed3SPierre Pronchery=item B<-in> I<filename>|I<uri>
163*b077aed3SPierre Pronchery
164*b077aed3SPierre ProncheryThis specifies the input filename or URI.
165*b077aed3SPierre ProncheryStandard input is used by default.
166*b077aed3SPierre ProncheryWithout the B<-export> option this must be PKCS#12 file to be parsed.
167*b077aed3SPierre ProncheryFor use with the B<-export> option
168*b077aed3SPierre Proncherysee the L</PKCS#12 output (export) options> section.
169*b077aed3SPierre Pronchery
170*b077aed3SPierre Pronchery=item B<-out> I<filename>
171*b077aed3SPierre Pronchery
172*b077aed3SPierre ProncheryThe filename to write certificates and private keys to, standard output by
173*b077aed3SPierre Proncherydefault.  They are all written in PEM format.
174*b077aed3SPierre Pronchery
175*b077aed3SPierre Pronchery=item B<-info>
176*b077aed3SPierre Pronchery
177*b077aed3SPierre ProncheryOutput additional information about the PKCS#12 file structure, algorithms
178*b077aed3SPierre Proncheryused and iteration counts.
179*b077aed3SPierre Pronchery
180*b077aed3SPierre Pronchery=item B<-nomacver>
181*b077aed3SPierre Pronchery
182*b077aed3SPierre ProncheryDon't attempt to verify the integrity MAC.
183*b077aed3SPierre Pronchery
184*b077aed3SPierre Pronchery=item B<-clcerts>
185*b077aed3SPierre Pronchery
186*b077aed3SPierre ProncheryOnly output client certificates (not CA certificates).
187*b077aed3SPierre Pronchery
188*b077aed3SPierre Pronchery=item B<-cacerts>
189*b077aed3SPierre Pronchery
190*b077aed3SPierre ProncheryOnly output CA certificates (not client certificates).
191*b077aed3SPierre Pronchery
192*b077aed3SPierre Pronchery=item B<-aes128>, B<-aes192>, B<-aes256>
193*b077aed3SPierre Pronchery
194*b077aed3SPierre ProncheryUse AES to encrypt private keys before outputting.
195*b077aed3SPierre Pronchery
196*b077aed3SPierre Pronchery=item B<-aria128>, B<-aria192>, B<-aria256>
197*b077aed3SPierre Pronchery
198*b077aed3SPierre ProncheryUse ARIA to encrypt private keys before outputting.
199*b077aed3SPierre Pronchery
200*b077aed3SPierre Pronchery=item B<-camellia128>, B<-camellia192>, B<-camellia256>
201*b077aed3SPierre Pronchery
202*b077aed3SPierre ProncheryUse Camellia to encrypt private keys before outputting.
203*b077aed3SPierre Pronchery
204*b077aed3SPierre Pronchery=item B<-des>
205*b077aed3SPierre Pronchery
206*b077aed3SPierre ProncheryUse DES to encrypt private keys before outputting.
207*b077aed3SPierre Pronchery
208*b077aed3SPierre Pronchery=item B<-des3>
209*b077aed3SPierre Pronchery
210*b077aed3SPierre ProncheryUse triple DES to encrypt private keys before outputting.
211*b077aed3SPierre Pronchery
212*b077aed3SPierre Pronchery=item B<-idea>
213*b077aed3SPierre Pronchery
214*b077aed3SPierre ProncheryUse IDEA to encrypt private keys before outputting.
215*b077aed3SPierre Pronchery
216*b077aed3SPierre Pronchery=item B<-noenc>
217*b077aed3SPierre Pronchery
218*b077aed3SPierre ProncheryDon't encrypt private keys at all.
219*b077aed3SPierre Pronchery
220*b077aed3SPierre Pronchery=item B<-nodes>
221*b077aed3SPierre Pronchery
222*b077aed3SPierre ProncheryThis option is deprecated since OpenSSL 3.0; use B<-noenc> instead.
223*b077aed3SPierre Pronchery
224*b077aed3SPierre Pronchery=back
225*b077aed3SPierre Pronchery
226*b077aed3SPierre Pronchery=head2 PKCS#12 output (export) options
227*b077aed3SPierre Pronchery
228*b077aed3SPierre Pronchery=over 4
229*b077aed3SPierre Pronchery
230*b077aed3SPierre Pronchery=item B<-export>
231*b077aed3SPierre Pronchery
232*b077aed3SPierre ProncheryThis option specifies that a PKCS#12 file will be created rather than
233*b077aed3SPierre Proncheryparsed.
234*b077aed3SPierre Pronchery
235*b077aed3SPierre Pronchery=item B<-out> I<filename>
236*b077aed3SPierre Pronchery
237*b077aed3SPierre ProncheryThis specifies filename to write the PKCS#12 file to. Standard output is used
238*b077aed3SPierre Proncheryby default.
239*b077aed3SPierre Pronchery
240*b077aed3SPierre Pronchery=item B<-in> I<filename>|I<uri>
241*b077aed3SPierre Pronchery
242*b077aed3SPierre ProncheryThis specifies the input filename or URI.
243*b077aed3SPierre ProncheryStandard input is used by default.
244*b077aed3SPierre ProncheryWith the B<-export> option this is a file with certificates and a key,
245*b077aed3SPierre Proncheryor a URI that refers to a key accessed via an engine.
246*b077aed3SPierre ProncheryThe order of credentials in a file doesn't matter but one private key and
247*b077aed3SPierre Proncheryits corresponding certificate should be present. If additional
248*b077aed3SPierre Proncherycertificates are present they will also be included in the PKCS#12 output file.
249*b077aed3SPierre Pronchery
250*b077aed3SPierre Pronchery=item B<-inkey> I<filename>|I<uri>
251*b077aed3SPierre Pronchery
252*b077aed3SPierre ProncheryThe private key input for PKCS12 output.
253*b077aed3SPierre ProncheryIf this option is not specified then the input file (B<-in> argument) must
254*b077aed3SPierre Proncherycontain a private key.
255*b077aed3SPierre ProncheryIf no engine is used, the argument is taken as a file.
256*b077aed3SPierre ProncheryIf the B<-engine> option is used or the URI has prefix C<org.openssl.engine:>
257*b077aed3SPierre Proncherythen the rest of the URI is taken as key identifier for the given engine.
258*b077aed3SPierre Pronchery
259*b077aed3SPierre Pronchery=item B<-certfile> I<filename>
260*b077aed3SPierre Pronchery
261*b077aed3SPierre ProncheryAn input file with extra certificates to be added to the PKCS#12 output
262*b077aed3SPierre Proncheryif the B<-export> option is given.
263*b077aed3SPierre Pronchery
264*b077aed3SPierre Pronchery=item B<-passcerts> I<arg>
265*b077aed3SPierre Pronchery
266*b077aed3SPierre ProncheryThe password source for certificate input such as B<-certfile>
267*b077aed3SPierre Proncheryand B<-untrusted>.
268*b077aed3SPierre ProncheryFor more information about the format of B<arg> see
269*b077aed3SPierre ProncheryL<openssl-passphrase-options(1)>.
270*b077aed3SPierre Pronchery
271*b077aed3SPierre Pronchery=item B<-chain>
272*b077aed3SPierre Pronchery
273*b077aed3SPierre ProncheryIf this option is present then the certificate chain of the end entity
274*b077aed3SPierre Proncherycertificate is built and included in the PKCS#12 output file.
275*b077aed3SPierre ProncheryThe end entity certificate is the first one read from the B<-in> file
276*b077aed3SPierre Proncheryif no key is given, else the first certificate matching the given key.
277*b077aed3SPierre ProncheryThe standard CA trust store is used for chain building,
278*b077aed3SPierre Proncheryas well as any untrusted CA certificates given with the B<-untrusted> option.
279*b077aed3SPierre Pronchery
280*b077aed3SPierre Pronchery=item B<-untrusted> I<filename>
281*b077aed3SPierre Pronchery
282*b077aed3SPierre ProncheryAn input file of untrusted certificates that may be used
283*b077aed3SPierre Proncheryfor chain building, which is relevant only when a PKCS#12 file is created
284*b077aed3SPierre Proncherywith the B<-export> option and the B<-chain> option is given as well.
285*b077aed3SPierre ProncheryAny certificates that are actually part of the chain are added to the output.
286*b077aed3SPierre Pronchery
287*b077aed3SPierre Pronchery{- $OpenSSL::safe::opt_trust_item -}
288*b077aed3SPierre Pronchery
289*b077aed3SPierre Pronchery=item B<-name> I<friendlyname>
290*b077aed3SPierre Pronchery
291*b077aed3SPierre ProncheryThis specifies the "friendly name" for the certificates and private key. This
292*b077aed3SPierre Proncheryname is typically displayed in list boxes by software importing the file.
293*b077aed3SPierre Pronchery
294*b077aed3SPierre Pronchery=item B<-caname> I<friendlyname>
295*b077aed3SPierre Pronchery
296*b077aed3SPierre ProncheryThis specifies the "friendly name" for other certificates. This option may be
297*b077aed3SPierre Proncheryused multiple times to specify names for all certificates in the order they
298*b077aed3SPierre Proncheryappear. Netscape ignores friendly names on other certificates whereas MSIE
299*b077aed3SPierre Proncherydisplays them.
300*b077aed3SPierre Pronchery
301*b077aed3SPierre Pronchery=item B<-CSP> I<name>
302*b077aed3SPierre Pronchery
303*b077aed3SPierre ProncheryWrite I<name> as a Microsoft CSP name.
304*b077aed3SPierre ProncheryThe password source for the input, and for encrypting any private keys that
305*b077aed3SPierre Proncheryare output.
306*b077aed3SPierre ProncheryFor more information about the format of B<arg>
307*b077aed3SPierre Proncherysee L<openssl-passphrase-options(1)>.
308*b077aed3SPierre Pronchery
309*b077aed3SPierre Pronchery=item B<-LMK>
310*b077aed3SPierre Pronchery
311*b077aed3SPierre ProncheryAdd the "Local Key Set" identifier to the attributes.
312*b077aed3SPierre Pronchery
313*b077aed3SPierre Pronchery=item B<-keyex>|B<-keysig>
314*b077aed3SPierre Pronchery
315*b077aed3SPierre ProncherySpecifies that the private key is to be used for key exchange or just signing.
316*b077aed3SPierre ProncheryThis option is only interpreted by MSIE and similar MS software. Normally
317*b077aed3SPierre Pronchery"export grade" software will only allow 512 bit RSA keys to be used for
318*b077aed3SPierre Proncheryencryption purposes but arbitrary length keys for signing. The B<-keysig>
319*b077aed3SPierre Proncheryoption marks the key for signing only. Signing only keys can be used for
320*b077aed3SPierre ProncheryS/MIME signing, authenticode (ActiveX control signing)  and SSL client
321*b077aed3SPierre Proncheryauthentication, however, due to a bug only MSIE 5.0 and later support
322*b077aed3SPierre Proncherythe use of signing only keys for SSL client authentication.
323*b077aed3SPierre Pronchery
324*b077aed3SPierre Pronchery=item B<-keypbe> I<alg>, B<-certpbe> I<alg>
325*b077aed3SPierre Pronchery
326*b077aed3SPierre ProncheryThese options allow the algorithm used to encrypt the private key and
327*b077aed3SPierre Proncherycertificates to be selected. Any PKCS#5 v1.5 or PKCS#12 PBE algorithm name
328*b077aed3SPierre Proncherycan be used (see L</NOTES> section for more information). If a cipher name
329*b077aed3SPierre Pronchery(as output by C<openssl list -cipher-algorithms>) is specified then it
330*b077aed3SPierre Proncheryis used with PKCS#5 v2.0. For interoperability reasons it is advisable to only
331*b077aed3SPierre Proncheryuse PKCS#12 algorithms.
332*b077aed3SPierre Pronchery
333*b077aed3SPierre ProncherySpecial value C<NONE> disables encryption of the private key and certificates.
334*b077aed3SPierre Pronchery
335*b077aed3SPierre Pronchery=item B<-descert>
336*b077aed3SPierre Pronchery
337*b077aed3SPierre ProncheryEncrypt the certificates using triple DES. By default the private
338*b077aed3SPierre Proncherykey and the certificates are encrypted using AES-256-CBC unless
339*b077aed3SPierre Proncherythe '-legacy' option is used. If '-descert' is used with the '-legacy'
340*b077aed3SPierre Proncherythen both, the private key and the certificates are encrypted using triple DES.
341*b077aed3SPierre Pronchery
342*b077aed3SPierre Pronchery=item B<-macalg> I<digest>
343*b077aed3SPierre Pronchery
344*b077aed3SPierre ProncherySpecify the MAC digest algorithm. If not included SHA256 will be used.
345*b077aed3SPierre Pronchery
346*b077aed3SPierre Pronchery=item B<-iter> I<count>
347*b077aed3SPierre Pronchery
348*b077aed3SPierre ProncheryThis option specifies the iteration count for the encryption key and MAC. The
349*b077aed3SPierre Proncherydefault value is 2048.
350*b077aed3SPierre Pronchery
351*b077aed3SPierre ProncheryTo discourage attacks by using large dictionaries of common passwords the
352*b077aed3SPierre Proncheryalgorithm that derives keys from passwords can have an iteration count applied
353*b077aed3SPierre Proncheryto it: this causes a certain part of the algorithm to be repeated and slows it
354*b077aed3SPierre Proncherydown. The MAC is used to check the file integrity but since it will normally
355*b077aed3SPierre Proncheryhave the same password as the keys and certificates it could also be attacked.
356*b077aed3SPierre Pronchery
357*b077aed3SPierre Pronchery=item B<-noiter>, B<-nomaciter>
358*b077aed3SPierre Pronchery
359*b077aed3SPierre ProncheryBy default both encryption and MAC iteration counts are set to 2048, using
360*b077aed3SPierre Proncherythese options the MAC and encryption iteration counts can be set to 1, since
361*b077aed3SPierre Proncherythis reduces the file security you should not use these options unless you
362*b077aed3SPierre Proncheryreally have to. Most software supports both MAC and encryption iteration counts.
363*b077aed3SPierre ProncheryMSIE 4.0 doesn't support MAC iteration counts so it needs the B<-nomaciter>
364*b077aed3SPierre Proncheryoption.
365*b077aed3SPierre Pronchery
366*b077aed3SPierre Pronchery=item B<-maciter>
367*b077aed3SPierre Pronchery
368*b077aed3SPierre ProncheryThis option is included for compatibility with previous versions, it used
369*b077aed3SPierre Proncheryto be needed to use MAC iterations counts but they are now used by default.
370*b077aed3SPierre Pronchery
371*b077aed3SPierre Pronchery=item B<-nomac>
372*b077aed3SPierre Pronchery
373*b077aed3SPierre ProncheryDo not attempt to provide the MAC integrity. This can be useful with the FIPS
374*b077aed3SPierre Proncheryprovider as the PKCS12 MAC requires PKCS12KDF which is not an approved FIPS
375*b077aed3SPierre Proncheryalgorithm and cannot be supported by the FIPS provider.
376*b077aed3SPierre Pronchery
377*b077aed3SPierre Pronchery=back
378*b077aed3SPierre Pronchery
379*b077aed3SPierre Pronchery=head1 NOTES
380*b077aed3SPierre Pronchery
381*b077aed3SPierre ProncheryAlthough there are a large number of options most of them are very rarely
382*b077aed3SPierre Proncheryused. For PKCS#12 file parsing only B<-in> and B<-out> need to be used
383*b077aed3SPierre Proncheryfor PKCS#12 file creation B<-export> and B<-name> are also used.
384*b077aed3SPierre Pronchery
385*b077aed3SPierre ProncheryIf none of the B<-clcerts>, B<-cacerts> or B<-nocerts> options are present
386*b077aed3SPierre Proncherythen all certificates will be output in the order they appear in the input
387*b077aed3SPierre ProncheryPKCS#12 files. There is no guarantee that the first certificate present is
388*b077aed3SPierre Proncherythe one corresponding to the private key.
389*b077aed3SPierre ProncheryCertain software which tries to get a private key and the corresponding
390*b077aed3SPierre Proncherycertificate might assume that the first certificate in the file is the one
391*b077aed3SPierre Proncherycorresponding to the private key, but that may not always be the case.
392*b077aed3SPierre ProncheryUsing the B<-clcerts> option will solve this problem by only
393*b077aed3SPierre Proncheryoutputting the certificate corresponding to the private key. If the CA
394*b077aed3SPierre Proncherycertificates are required then they can be output to a separate file using
395*b077aed3SPierre Proncherythe B<-nokeys> B<-cacerts> options to just output CA certificates.
396*b077aed3SPierre Pronchery
397*b077aed3SPierre ProncheryThe B<-keypbe> and B<-certpbe> algorithms allow the precise encryption
398*b077aed3SPierre Proncheryalgorithms for private keys and certificates to be specified. Normally
399*b077aed3SPierre Proncherythe defaults are fine but occasionally software can't handle triple DES
400*b077aed3SPierre Proncheryencrypted private keys, then the option B<-keypbe> I<PBE-SHA1-RC2-40> can
401*b077aed3SPierre Proncherybe used to reduce the private key encryption to 40 bit RC2. A complete
402*b077aed3SPierre Proncherydescription of all algorithms is contained in L<openssl-pkcs8(1)>.
403*b077aed3SPierre Pronchery
404*b077aed3SPierre ProncheryPrior 1.1 release passwords containing non-ASCII characters were encoded
405*b077aed3SPierre Proncheryin non-compliant manner, which limited interoperability, in first hand
406*b077aed3SPierre Proncherywith Windows. But switching to standard-compliant password encoding
407*b077aed3SPierre Proncheryposes problem accessing old data protected with broken encoding. For
408*b077aed3SPierre Proncherythis reason even legacy encodings is attempted when reading the
409*b077aed3SPierre Proncherydata. If you use PKCS#12 files in production application you are advised
410*b077aed3SPierre Proncheryto convert the data, because implemented heuristic approach is not
411*b077aed3SPierre ProncheryMT-safe, its sole goal is to facilitate the data upgrade with this
412*b077aed3SPierre Proncherycommand.
413*b077aed3SPierre Pronchery
414*b077aed3SPierre Pronchery=head1 EXAMPLES
415*b077aed3SPierre Pronchery
416*b077aed3SPierre ProncheryParse a PKCS#12 file and output it to a PEM file:
417*b077aed3SPierre Pronchery
418*b077aed3SPierre Pronchery openssl pkcs12 -in file.p12 -out file.pem
419*b077aed3SPierre Pronchery
420*b077aed3SPierre ProncheryOutput only client certificates to a file:
421*b077aed3SPierre Pronchery
422*b077aed3SPierre Pronchery openssl pkcs12 -in file.p12 -clcerts -out file.pem
423*b077aed3SPierre Pronchery
424*b077aed3SPierre ProncheryDon't encrypt the private key:
425*b077aed3SPierre Pronchery
426*b077aed3SPierre Pronchery openssl pkcs12 -in file.p12 -out file.pem -noenc
427*b077aed3SPierre Pronchery
428*b077aed3SPierre ProncheryPrint some info about a PKCS#12 file:
429*b077aed3SPierre Pronchery
430*b077aed3SPierre Pronchery openssl pkcs12 -in file.p12 -info -noout
431*b077aed3SPierre Pronchery
432*b077aed3SPierre ProncheryPrint some info about a PKCS#12 file in legacy mode:
433*b077aed3SPierre Pronchery
434*b077aed3SPierre Pronchery openssl pkcs12 -in file.p12 -info -noout -legacy
435*b077aed3SPierre Pronchery
436*b077aed3SPierre ProncheryCreate a PKCS#12 file from a PEM file that may contain a key and certificates:
437*b077aed3SPierre Pronchery
438*b077aed3SPierre Pronchery openssl pkcs12 -export -in file.pem -out file.p12 -name "My PSE"
439*b077aed3SPierre Pronchery
440*b077aed3SPierre ProncheryInclude some extra certificates:
441*b077aed3SPierre Pronchery
442*b077aed3SPierre Pronchery openssl pkcs12 -export -in file.pem -out file.p12 -name "My PSE" \
443*b077aed3SPierre Pronchery  -certfile othercerts.pem
444*b077aed3SPierre Pronchery
445*b077aed3SPierre ProncheryExport a PKCS#12 file with data from a certificate PEM file and from a further
446*b077aed3SPierre ProncheryPEM file containing a key, with default algorithms as in the legacy provider:
447*b077aed3SPierre Pronchery
448*b077aed3SPierre Pronchery openssl pkcs12 -export -in cert.pem -inkey key.pem -out file.p12 -legacy
449*b077aed3SPierre Pronchery
450*b077aed3SPierre Pronchery=head1 SEE ALSO
451*b077aed3SPierre Pronchery
452*b077aed3SPierre ProncheryL<openssl(1)>,
453*b077aed3SPierre ProncheryL<openssl-pkcs8(1)>,
454*b077aed3SPierre ProncheryL<ossl_store-file(7)>
455*b077aed3SPierre Pronchery
456*b077aed3SPierre Pronchery=head1 HISTORY
457*b077aed3SPierre Pronchery
458*b077aed3SPierre ProncheryThe B<-engine> option was deprecated in OpenSSL 3.0.
459*b077aed3SPierre ProncheryThe B<-nodes> option was deprecated in OpenSSL 3.0, too; use B<-noenc> instead.
460*b077aed3SPierre Pronchery
461*b077aed3SPierre Pronchery=head1 COPYRIGHT
462*b077aed3SPierre Pronchery
463*b077aed3SPierre ProncheryCopyright 2000-2022 The OpenSSL Project Authors. All Rights Reserved.
464*b077aed3SPierre Pronchery
465*b077aed3SPierre ProncheryLicensed under the Apache License 2.0 (the "License").  You may not use
466*b077aed3SPierre Proncherythis file except in compliance with the License.  You can obtain a copy
467*b077aed3SPierre Proncheryin the file LICENSE in the source distribution or at
468*b077aed3SPierre ProncheryL<https://www.openssl.org/source/license.html>.
469*b077aed3SPierre Pronchery
470*b077aed3SPierre Pronchery=cut
471