| 1 |
.\" -*- mode: troff; coding: utf-8 -*- |
| 2 |
.\" Automatically generated by Pod::Man 5.0102 (Pod::Simple 3.45) |
| 3 |
.\" |
| 4 |
.\" Standard preamble: |
| 5 |
.\" ======================================================================== |
| 6 |
.de Sp \" Vertical space (when we can't use .PP) |
| 7 |
.if t .sp .5v |
| 8 |
.if n .sp |
| 9 |
.. |
| 10 |
.de Vb \" Begin verbatim text |
| 11 |
.ft CW |
| 12 |
.nf |
| 13 |
.ne \\$1 |
| 14 |
.. |
| 15 |
.de Ve \" End verbatim text |
| 16 |
.ft R |
| 17 |
.fi |
| 18 |
.. |
| 19 |
.\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. |
| 20 |
.ie n \{\ |
| 21 |
. ds C` "" |
| 22 |
. ds C' "" |
| 23 |
'br\} |
| 24 |
.el\{\ |
| 25 |
. ds C` |
| 26 |
. ds C' |
| 27 |
'br\} |
| 28 |
.\" |
| 29 |
.\" Escape single quotes in literal strings from groff's Unicode transform. |
| 30 |
.ie \n(.g .ds Aq \(aq |
| 31 |
.el .ds Aq ' |
| 32 |
.\" |
| 33 |
.\" If the F register is >0, we'll generate index entries on stderr for |
| 34 |
.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index |
| 35 |
.\" entries marked with X<> in POD. Of course, you'll have to process the |
| 36 |
.\" output yourself in some meaningful fashion. |
| 37 |
.\" |
| 38 |
.\" Avoid warning from groff about undefined register 'F'. |
| 39 |
.de IX |
| 40 |
.. |
| 41 |
.nr rF 0 |
| 42 |
.if \n(.g .if rF .nr rF 1 |
| 43 |
.if (\n(rF:(\n(.g==0)) \{\ |
| 44 |
. if \nF \{\ |
| 45 |
. de IX |
| 46 |
. tm Index:\\$1\t\\n%\t"\\$2" |
| 47 |
.. |
| 48 |
. if !\nF==2 \{\ |
| 49 |
. nr % 0 |
| 50 |
. nr F 2 |
| 51 |
. \} |
| 52 |
. \} |
| 53 |
.\} |
| 54 |
.rr rF |
| 55 |
.\" ======================================================================== |
| 56 |
.\" |
| 57 |
.IX Title "OPENSSL-PKCS12 1SSL" |
| 58 |
.TH OPENSSL-PKCS12 1SSL 2026-04-07 3.6.2 OpenSSL |
| 59 |
.\" For nroff, turn off justification. Always turn off hyphenation; it makes |
| 60 |
.\" way too many mistakes in technical documents. |
| 61 |
.if n .ad l |
| 62 |
.nh |
| 63 |
.SH NAME |
| 64 |
openssl\-pkcs12 \- PKCS#12 file command |
| 65 |
.SH SYNOPSIS |
| 66 |
.IX Header "SYNOPSIS" |
| 67 |
\&\fBopenssl\fR \fBpkcs12\fR |
| 68 |
[\fB\-help\fR] |
| 69 |
[\fB\-passin\fR \fIarg\fR] |
| 70 |
[\fB\-passout\fR \fIarg\fR] |
| 71 |
[\fB\-password\fR \fIarg\fR] |
| 72 |
[\fB\-twopass\fR] |
| 73 |
[\fB\-in\fR \fIfilename\fR|\fIuri\fR] |
| 74 |
[\fB\-out\fR \fIfilename\fR] |
| 75 |
[\fB\-nokeys\fR] |
| 76 |
[\fB\-nocerts\fR] |
| 77 |
[\fB\-noout\fR] |
| 78 |
[\fB\-legacy\fR] |
| 79 |
[\fB\-engine\fR \fIid\fR] |
| 80 |
[\fB\-provider\fR \fIname\fR] |
| 81 |
[\fB\-provider\-path\fR \fIpath\fR] |
| 82 |
[\fB\-provparam\fR \fI[name:]key=value\fR] |
| 83 |
[\fB\-propquery\fR \fIpropq\fR] |
| 84 |
[\fB\-rand\fR \fIfiles\fR] |
| 85 |
[\fB\-writerand\fR \fIfile\fR] |
| 86 |
.PP |
| 87 |
PKCS#12 input (parsing) options: |
| 88 |
[\fB\-info\fR] |
| 89 |
[\fB\-nomacver\fR] |
| 90 |
[\fB\-clcerts\fR] |
| 91 |
[\fB\-cacerts\fR] |
| 92 |
.PP |
| 93 |
[\fB\-aes128\fR] |
| 94 |
[\fB\-aes192\fR] |
| 95 |
[\fB\-aes256\fR] |
| 96 |
[\fB\-aria128\fR] |
| 97 |
[\fB\-aria192\fR] |
| 98 |
[\fB\-aria256\fR] |
| 99 |
[\fB\-camellia128\fR] |
| 100 |
[\fB\-camellia192\fR] |
| 101 |
[\fB\-camellia256\fR] |
| 102 |
[\fB\-des\fR] |
| 103 |
[\fB\-des3\fR] |
| 104 |
[\fB\-idea\fR] |
| 105 |
[\fB\-noenc\fR] |
| 106 |
[\fB\-nodes\fR] |
| 107 |
.PP |
| 108 |
PKCS#12 output (export) options: |
| 109 |
.PP |
| 110 |
[\fB\-export\fR] |
| 111 |
[\fB\-inkey\fR \fIfilename\fR|\fIuri\fR] |
| 112 |
[\fB\-certfile\fR \fIfilename\fR] |
| 113 |
[\fB\-passcerts\fR \fIarg\fR] |
| 114 |
[\fB\-chain\fR] |
| 115 |
[\fB\-untrusted\fR \fIfilename\fR] |
| 116 |
[\fB\-CAfile\fR \fIfile\fR] |
| 117 |
[\fB\-no\-CAfile\fR] |
| 118 |
[\fB\-CApath\fR \fIdir\fR] |
| 119 |
[\fB\-no\-CApath\fR] |
| 120 |
[\fB\-CAstore\fR \fIuri\fR] |
| 121 |
[\fB\-no\-CAstore\fR] |
| 122 |
[\fB\-name\fR \fIname\fR] |
| 123 |
[\fB\-caname\fR \fIname\fR] |
| 124 |
[\fB\-CSP\fR \fIname\fR] |
| 125 |
[\fB\-LMK\fR] |
| 126 |
[\fB\-keyex\fR] |
| 127 |
[\fB\-keysig\fR] |
| 128 |
[\fB\-keypbe\fR \fIcipher\fR] |
| 129 |
[\fB\-certpbe\fR \fIcipher\fR] |
| 130 |
[\fB\-descert\fR] |
| 131 |
[\fB\-macalg\fR \fIdigest\fR] |
| 132 |
[\fB\-pbmac1_pbkdf2\fR] |
| 133 |
[\fB\-pbmac1_pbkdf2_md\fR \fIdigest\fR] |
| 134 |
[\fB\-iter\fR \fIcount\fR] |
| 135 |
[\fB\-noiter\fR] |
| 136 |
[\fB\-nomaciter\fR] |
| 137 |
[\fB\-maciter\fR] |
| 138 |
[\fB\-macsaltlen\fR] |
| 139 |
[\fB\-nomac\fR] |
| 140 |
[\fB\-jdktrust\fR \fIusage\fR] |
| 141 |
.SH DESCRIPTION |
| 142 |
.IX Header "DESCRIPTION" |
| 143 |
This command allows PKCS#12 files (sometimes referred to as |
| 144 |
PFX files) to be created and parsed. PKCS#12 files are used by several |
| 145 |
programs including Netscape, MSIE and MS Outlook. |
| 146 |
.SH OPTIONS |
| 147 |
.IX Header "OPTIONS" |
| 148 |
There are a lot of options the meaning of some depends of whether a PKCS#12 file |
| 149 |
is being created or parsed. By default a PKCS#12 file is parsed. |
| 150 |
A PKCS#12 file can be created by using the \fB\-export\fR option (see below). |
| 151 |
The PKCS#12 export encryption and MAC options such as \fB\-certpbe\fR and \fB\-iter\fR |
| 152 |
and many further options such as \fB\-chain\fR are relevant only with \fB\-export\fR. |
| 153 |
Conversely, the options regarding encryption of private keys when outputting |
| 154 |
PKCS#12 input are relevant only when the \fB\-export\fR option is not given. |
| 155 |
.PP |
| 156 |
The default encryption algorithm is AES\-256\-CBC with PBKDF2 for key derivation. |
| 157 |
.PP |
| 158 |
When encountering problems loading legacy PKCS#12 files that involve, |
| 159 |
for example, RC2\-40\-CBC, |
| 160 |
try using the \fB\-legacy\fR option and, if needed, the \fB\-provider\-path\fR option. |
| 161 |
.IP \fB\-help\fR 4 |
| 162 |
.IX Item "-help" |
| 163 |
Print out a usage message. |
| 164 |
.IP "\fB\-passin\fR \fIarg\fR" 4 |
| 165 |
.IX Item "-passin arg" |
| 166 |
The password source for the input, and for encrypting any private keys that |
| 167 |
are output. |
| 168 |
For more information about the format of \fBarg\fR |
| 169 |
see \fBopenssl\-passphrase\-options\fR\|(1). |
| 170 |
.IP "\fB\-passout\fR \fIarg\fR" 4 |
| 171 |
.IX Item "-passout arg" |
| 172 |
The password source for output files. |
| 173 |
.IP "\fB\-password\fR \fIarg\fR" 4 |
| 174 |
.IX Item "-password arg" |
| 175 |
With \fB\-export\fR, \fB\-password\fR is equivalent to \fB\-passout\fR, |
| 176 |
otherwise it is equivalent to \fB\-passin\fR. |
| 177 |
.IP \fB\-twopass\fR 4 |
| 178 |
.IX Item "-twopass" |
| 179 |
Prompt for separate integrity and encryption passwords: most software |
| 180 |
always assumes these are the same so this option will render such |
| 181 |
PKCS#12 files unreadable. Cannot be used in combination with the options |
| 182 |
\&\fB\-password\fR, \fB\-passin\fR if importing from PKCS#12, or \fB\-passout\fR if exporting. |
| 183 |
.IP \fB\-nokeys\fR 4 |
| 184 |
.IX Item "-nokeys" |
| 185 |
No private keys will be output. |
| 186 |
.IP \fB\-nocerts\fR 4 |
| 187 |
.IX Item "-nocerts" |
| 188 |
No certificates will be output. |
| 189 |
.IP \fB\-noout\fR 4 |
| 190 |
.IX Item "-noout" |
| 191 |
This option inhibits all credentials output, |
| 192 |
and so the input is just verified. |
| 193 |
.IP \fB\-legacy\fR 4 |
| 194 |
.IX Item "-legacy" |
| 195 |
Use legacy mode of operation and automatically load the legacy provider. |
| 196 |
If OpenSSL is not installed system-wide, |
| 197 |
it is necessary to also use, for example, \f(CW\*(C`\-provider\-path ./providers\*(C'\fR |
| 198 |
or to set the environment variable \fBOPENSSL_MODULES\fR |
| 199 |
to point to the directory where the providers can be found. |
| 200 |
.Sp |
| 201 |
In the legacy mode, the default algorithm for certificate encryption |
| 202 |
is RC2_CBC or 3DES_CBC depending on whether the RC2 cipher is enabled |
| 203 |
in the build. The default algorithm for private key encryption is 3DES_CBC. |
| 204 |
If the legacy option is not specified, then the legacy provider is not loaded |
| 205 |
and the default encryption algorithm for both certificates and private keys is |
| 206 |
AES_256_CBC with PBKDF2 for key derivation. |
| 207 |
.IP "\fB\-engine\fR \fIid\fR" 4 |
| 208 |
.IX Item "-engine id" |
| 209 |
See "Engine Options" in \fBopenssl\fR\|(1). |
| 210 |
This option is deprecated. |
| 211 |
.IP "\fB\-provider\fR \fIname\fR" 4 |
| 212 |
.IX Item "-provider name" |
| 213 |
.PD 0 |
| 214 |
.IP "\fB\-provider\-path\fR \fIpath\fR" 4 |
| 215 |
.IX Item "-provider-path path" |
| 216 |
.IP "\fB\-provparam\fR \fI[name:]key=value\fR" 4 |
| 217 |
.IX Item "-provparam [name:]key=value" |
| 218 |
.IP "\fB\-propquery\fR \fIpropq\fR" 4 |
| 219 |
.IX Item "-propquery propq" |
| 220 |
.PD |
| 221 |
See "Provider Options" in \fBopenssl\fR\|(1), \fBprovider\fR\|(7), and \fBproperty\fR\|(7). |
| 222 |
.IP "\fB\-rand\fR \fIfiles\fR, \fB\-writerand\fR \fIfile\fR" 4 |
| 223 |
.IX Item "-rand files, -writerand file" |
| 224 |
See "Random State Options" in \fBopenssl\fR\|(1) for details. |
| 225 |
.SS "PKCS#12 input (parsing) options" |
| 226 |
.IX Subsection "PKCS#12 input (parsing) options" |
| 227 |
.IP "\fB\-in\fR \fIfilename\fR|\fIuri\fR" 4 |
| 228 |
.IX Item "-in filename|uri" |
| 229 |
This specifies the input filename or URI. |
| 230 |
Standard input is used by default. |
| 231 |
Without the \fB\-export\fR option this must be PKCS#12 file to be parsed. |
| 232 |
For use with the \fB\-export\fR option |
| 233 |
see the "PKCS#12 output (export) options" section. |
| 234 |
.IP "\fB\-out\fR \fIfilename\fR" 4 |
| 235 |
.IX Item "-out filename" |
| 236 |
The filename to write certificates and private keys to, standard output by |
| 237 |
default. They are all written in PEM format. |
| 238 |
.IP \fB\-info\fR 4 |
| 239 |
.IX Item "-info" |
| 240 |
Output additional information about the PKCS#12 file structure, algorithms |
| 241 |
used and iteration counts. |
| 242 |
.IP \fB\-nomacver\fR 4 |
| 243 |
.IX Item "-nomacver" |
| 244 |
Don't attempt to verify the integrity MAC. |
| 245 |
.IP \fB\-clcerts\fR 4 |
| 246 |
.IX Item "-clcerts" |
| 247 |
Only output client certificates (not CA certificates). |
| 248 |
.IP \fB\-cacerts\fR 4 |
| 249 |
.IX Item "-cacerts" |
| 250 |
Only output CA certificates (not client certificates). |
| 251 |
.IP "\fB\-aes128\fR, \fB\-aes192\fR, \fB\-aes256\fR" 4 |
| 252 |
.IX Item "-aes128, -aes192, -aes256" |
| 253 |
Use AES to encrypt private keys before outputting. |
| 254 |
.IP "\fB\-aria128\fR, \fB\-aria192\fR, \fB\-aria256\fR" 4 |
| 255 |
.IX Item "-aria128, -aria192, -aria256" |
| 256 |
Use ARIA to encrypt private keys before outputting. |
| 257 |
.IP "\fB\-camellia128\fR, \fB\-camellia192\fR, \fB\-camellia256\fR" 4 |
| 258 |
.IX Item "-camellia128, -camellia192, -camellia256" |
| 259 |
Use Camellia to encrypt private keys before outputting. |
| 260 |
.IP \fB\-des\fR 4 |
| 261 |
.IX Item "-des" |
| 262 |
Use DES to encrypt private keys before outputting. |
| 263 |
.IP \fB\-des3\fR 4 |
| 264 |
.IX Item "-des3" |
| 265 |
Use triple DES to encrypt private keys before outputting. |
| 266 |
.IP \fB\-idea\fR 4 |
| 267 |
.IX Item "-idea" |
| 268 |
Use IDEA to encrypt private keys before outputting. |
| 269 |
.IP \fB\-noenc\fR 4 |
| 270 |
.IX Item "-noenc" |
| 271 |
Don't encrypt private keys at all. |
| 272 |
.IP \fB\-nodes\fR 4 |
| 273 |
.IX Item "-nodes" |
| 274 |
This option is deprecated since OpenSSL 3.0; use \fB\-noenc\fR instead. |
| 275 |
.SS "PKCS#12 output (export) options" |
| 276 |
.IX Subsection "PKCS#12 output (export) options" |
| 277 |
.IP \fB\-export\fR 4 |
| 278 |
.IX Item "-export" |
| 279 |
This option specifies that a PKCS#12 file will be created rather than |
| 280 |
parsed. |
| 281 |
.IP "\fB\-out\fR \fIfilename\fR" 4 |
| 282 |
.IX Item "-out filename" |
| 283 |
This specifies filename to write the PKCS#12 file to. Standard output is used |
| 284 |
by default. |
| 285 |
.IP "\fB\-in\fR \fIfilename\fR|\fIuri\fR" 4 |
| 286 |
.IX Item "-in filename|uri" |
| 287 |
This specifies the input filename or URI. |
| 288 |
Standard input is used by default. |
| 289 |
With the \fB\-export\fR option this is a file with certificates and a key, |
| 290 |
or a URI that refers to a key accessed via an engine. |
| 291 |
The order of credentials in a file doesn't matter but one private key and |
| 292 |
its corresponding certificate should be present. If additional |
| 293 |
certificates are present they will also be included in the PKCS#12 output file. |
| 294 |
.IP "\fB\-inkey\fR \fIfilename\fR|\fIuri\fR" 4 |
| 295 |
.IX Item "-inkey filename|uri" |
| 296 |
The private key input for PKCS12 output. |
| 297 |
If this option is not specified then the input file (\fB\-in\fR argument) must |
| 298 |
contain a private key. |
| 299 |
If no engine is used, the argument is taken as a file. |
| 300 |
If the \fB\-engine\fR option is used or the URI has prefix \f(CW\*(C`org.openssl.engine:\*(C'\fR |
| 301 |
then the rest of the URI is taken as key identifier for the given engine. |
| 302 |
.IP "\fB\-certfile\fR \fIfilename\fR" 4 |
| 303 |
.IX Item "-certfile filename" |
| 304 |
An input file with extra certificates to be added to the PKCS#12 output |
| 305 |
if the \fB\-export\fR option is given. |
| 306 |
.IP "\fB\-passcerts\fR \fIarg\fR" 4 |
| 307 |
.IX Item "-passcerts arg" |
| 308 |
The password source for certificate input such as \fB\-certfile\fR |
| 309 |
and \fB\-untrusted\fR. |
| 310 |
For more information about the format of \fBarg\fR see |
| 311 |
\&\fBopenssl\-passphrase\-options\fR\|(1). |
| 312 |
.IP \fB\-chain\fR 4 |
| 313 |
.IX Item "-chain" |
| 314 |
If this option is present then the certificate chain of the end entity |
| 315 |
certificate is built and included in the PKCS#12 output file. |
| 316 |
The end entity certificate is the first one read from the \fB\-in\fR file |
| 317 |
if no key is given, else the first certificate matching the given key. |
| 318 |
The standard CA trust store is used for chain building, |
| 319 |
as well as any untrusted CA certificates given with the \fB\-untrusted\fR option. |
| 320 |
.IP "\fB\-untrusted\fR \fIfilename\fR" 4 |
| 321 |
.IX Item "-untrusted filename" |
| 322 |
An input file of untrusted certificates that may be used |
| 323 |
for chain building, which is relevant only when a PKCS#12 file is created |
| 324 |
with the \fB\-export\fR option and the \fB\-chain\fR option is given as well. |
| 325 |
Any certificates that are actually part of the chain are added to the output. |
| 326 |
.IP "\fB\-CAfile\fR \fIfile\fR, \fB\-no\-CAfile\fR, \fB\-CApath\fR \fIdir\fR, \fB\-no\-CApath\fR, \fB\-CAstore\fR \fIuri\fR, \fB\-no\-CAstore\fR" 4 |
| 327 |
.IX Item "-CAfile file, -no-CAfile, -CApath dir, -no-CApath, -CAstore uri, -no-CAstore" |
| 328 |
See "Trusted Certificate Options" in \fBopenssl\-verification\-options\fR\|(1) for details. |
| 329 |
.IP "\fB\-name\fR \fIfriendlyname\fR" 4 |
| 330 |
.IX Item "-name friendlyname" |
| 331 |
This specifies the "friendly name" for the certificates and private key. This |
| 332 |
name is typically displayed in list boxes by software importing the file. |
| 333 |
.IP "\fB\-caname\fR \fIfriendlyname\fR" 4 |
| 334 |
.IX Item "-caname friendlyname" |
| 335 |
This specifies the "friendly name" for other certificates. This option may be |
| 336 |
used multiple times to specify names for all certificates in the order they |
| 337 |
appear. Netscape ignores friendly names on other certificates whereas MSIE |
| 338 |
displays them. |
| 339 |
.IP "\fB\-CSP\fR \fIname\fR" 4 |
| 340 |
.IX Item "-CSP name" |
| 341 |
Write \fIname\fR as a Microsoft CSP name. |
| 342 |
The password source for the input, and for encrypting any private keys that |
| 343 |
are output. |
| 344 |
For more information about the format of \fBarg\fR |
| 345 |
see \fBopenssl\-passphrase\-options\fR\|(1). |
| 346 |
.IP \fB\-LMK\fR 4 |
| 347 |
.IX Item "-LMK" |
| 348 |
Add the "Local Key Set" identifier to the attributes. |
| 349 |
.IP \fB\-keyex\fR|\fB\-keysig\fR 4 |
| 350 |
.IX Item "-keyex|-keysig" |
| 351 |
Specifies that the private key is to be used for key exchange or just signing. |
| 352 |
This option is only interpreted by MSIE and similar MS software. Normally |
| 353 |
"export grade" software will only allow 512 bit RSA keys to be used for |
| 354 |
encryption purposes but arbitrary length keys for signing. The \fB\-keysig\fR |
| 355 |
option marks the key for signing only. Signing only keys can be used for |
| 356 |
S/MIME signing, authenticode (ActiveX control signing) and SSL client |
| 357 |
authentication, however, due to a bug only MSIE 5.0 and later support |
| 358 |
the use of signing only keys for SSL client authentication. |
| 359 |
.IP "\fB\-keypbe\fR \fIalg\fR, \fB\-certpbe\fR \fIalg\fR" 4 |
| 360 |
.IX Item "-keypbe alg, -certpbe alg" |
| 361 |
These options allow the algorithm used to encrypt the private key and |
| 362 |
certificates to be selected. Any PKCS#5 v1.5 or PKCS#12 PBE algorithm name |
| 363 |
can be used (see "NOTES" section for more information). If a cipher name |
| 364 |
(as output by \f(CW\*(C`openssl list \-cipher\-algorithms\*(C'\fR) is specified then it |
| 365 |
is used with PKCS#5 v2.0. For interoperability reasons it is advisable to only |
| 366 |
use PKCS#12 algorithms. |
| 367 |
.Sp |
| 368 |
Special value \f(CW\*(C`NONE\*(C'\fR disables encryption of the private key and certificates. |
| 369 |
.IP \fB\-descert\fR 4 |
| 370 |
.IX Item "-descert" |
| 371 |
Encrypt the certificates using triple DES. By default the private |
| 372 |
key and the certificates are encrypted using AES\-256\-CBC unless |
| 373 |
the '\-legacy' option is used. If '\-descert' is used with the '\-legacy' |
| 374 |
then both, the private key and the certificates are encrypted using triple DES. |
| 375 |
.IP "\fB\-macalg\fR \fIdigest\fR" 4 |
| 376 |
.IX Item "-macalg digest" |
| 377 |
Specify the MAC digest algorithm. If not included SHA256 will be used. |
| 378 |
.IP \fB\-pbmac1_pbkdf2\fR 4 |
| 379 |
.IX Item "-pbmac1_pbkdf2" |
| 380 |
Use PBMAC1 with PBKDF2 for MAC protection of the PKCS#12 file. |
| 381 |
.IP "\fB\-pbmac1_pbkdf2_md\fR \fIdigest\fR" 4 |
| 382 |
.IX Item "-pbmac1_pbkdf2_md digest" |
| 383 |
Specify the PBKDF2 KDF digest algorithm. If not specified, SHA256 will be used. |
| 384 |
Unless \f(CW\*(C`\-pbmac1_pbkdf2\*(C'\fR is specified, this parameter is ignored. |
| 385 |
.IP "\fB\-iter\fR \fIcount\fR" 4 |
| 386 |
.IX Item "-iter count" |
| 387 |
This option specifies the iteration count for the encryption key and MAC. The |
| 388 |
default value is 2048. |
| 389 |
.Sp |
| 390 |
To discourage attacks by using large dictionaries of common passwords the |
| 391 |
algorithm that derives keys from passwords can have an iteration count applied |
| 392 |
to it: this causes a certain part of the algorithm to be repeated and slows it |
| 393 |
down. The MAC is used to check the file integrity but since it will normally |
| 394 |
have the same password as the keys and certificates it could also be attacked. |
| 395 |
.IP "\fB\-noiter\fR, \fB\-nomaciter\fR" 4 |
| 396 |
.IX Item "-noiter, -nomaciter" |
| 397 |
By default both encryption and MAC iteration counts are set to 2048, using |
| 398 |
these options the MAC and encryption iteration counts can be set to 1, since |
| 399 |
this reduces the file security you should not use these options unless you |
| 400 |
really have to. Most software supports both MAC and encryption iteration counts. |
| 401 |
MSIE 4.0 doesn't support MAC iteration counts so it needs the \fB\-nomaciter\fR |
| 402 |
option. |
| 403 |
.IP \fB\-maciter\fR 4 |
| 404 |
.IX Item "-maciter" |
| 405 |
This option is included for compatibility with previous versions, it used |
| 406 |
to be needed to use MAC iterations counts but they are now used by default. |
| 407 |
.IP \fB\-macsaltlen\fR 4 |
| 408 |
.IX Item "-macsaltlen" |
| 409 |
This option specifies the salt length in bytes for the MAC. The salt |
| 410 |
length should be at least 16 bytes as per NIST SP 800\-132, which is |
| 411 |
the default value. |
| 412 |
.IP \fB\-nomac\fR 4 |
| 413 |
.IX Item "-nomac" |
| 414 |
Do not attempt to provide the MAC integrity. This can be useful with the FIPS |
| 415 |
provider as the PKCS12 MAC requires PKCS12KDF which is not an approved FIPS |
| 416 |
algorithm and cannot be supported by the FIPS provider. |
| 417 |
.IP \fB\-jdktrust\fR 4 |
| 418 |
.IX Item "-jdktrust" |
| 419 |
Export pkcs12 file in a format compatible with Java keystore usage. This option |
| 420 |
accepts a string parameter indicating the trust oid name to be granted to the |
| 421 |
certificate it is associated with. Currently only "anyExtendedKeyUsage" is |
| 422 |
defined. Note that, as Java keystores do not accept PKCS12 files with both |
| 423 |
trusted certificates and keypairs, use of this option implies the setting of the |
| 424 |
\&\fB\-nokeys\fR option |
| 425 |
.SH NOTES |
| 426 |
.IX Header "NOTES" |
| 427 |
Although there are a large number of options most of them are very rarely |
| 428 |
used. For PKCS#12 file parsing only \fB\-in\fR and \fB\-out\fR need to be used |
| 429 |
for PKCS#12 file creation \fB\-export\fR and \fB\-name\fR are also used. |
| 430 |
.PP |
| 431 |
If none of the \fB\-clcerts\fR, \fB\-cacerts\fR or \fB\-nocerts\fR options are present |
| 432 |
then all certificates will be output in the order they appear in the input |
| 433 |
PKCS#12 files. There is no guarantee that the first certificate present is |
| 434 |
the one corresponding to the private key. |
| 435 |
Certain software which tries to get a private key and the corresponding |
| 436 |
certificate might assume that the first certificate in the file is the one |
| 437 |
corresponding to the private key, but that may not always be the case. |
| 438 |
Using the \fB\-clcerts\fR option will solve this problem by only |
| 439 |
outputting the certificate corresponding to the private key. If the CA |
| 440 |
certificates are required then they can be output to a separate file using |
| 441 |
the \fB\-nokeys\fR \fB\-cacerts\fR options to just output CA certificates. |
| 442 |
.PP |
| 443 |
The \fB\-keypbe\fR and \fB\-certpbe\fR algorithms allow the precise encryption |
| 444 |
algorithms for private keys and certificates to be specified. Normally |
| 445 |
the defaults are fine but occasionally software can't handle triple DES |
| 446 |
encrypted private keys, then the option \fB\-keypbe\fR \fIPBE\-SHA1\-RC2\-40\fR can |
| 447 |
be used to reduce the private key encryption to 40 bit RC2. A complete |
| 448 |
description of all algorithms is contained in \fBopenssl\-pkcs8\fR\|(1). |
| 449 |
.PP |
| 450 |
Prior 1.1 release passwords containing non-ASCII characters were encoded |
| 451 |
in non-compliant manner, which limited interoperability, in first hand |
| 452 |
with Windows. But switching to standard-compliant password encoding |
| 453 |
poses problem accessing old data protected with broken encoding. For |
| 454 |
this reason even legacy encodings is attempted when reading the |
| 455 |
data. If you use PKCS#12 files in production application you are advised |
| 456 |
to convert the data, because implemented heuristic approach is not |
| 457 |
MT-safe, its sole goal is to facilitate the data upgrade with this |
| 458 |
command. |
| 459 |
.SH EXAMPLES |
| 460 |
.IX Header "EXAMPLES" |
| 461 |
Parse a PKCS#12 file and output it to a PEM file: |
| 462 |
.PP |
| 463 |
.Vb 1 |
| 464 |
\& openssl pkcs12 \-in file.p12 \-out file.pem |
| 465 |
.Ve |
| 466 |
.PP |
| 467 |
Output only client certificates to a file: |
| 468 |
.PP |
| 469 |
.Vb 1 |
| 470 |
\& openssl pkcs12 \-in file.p12 \-clcerts \-out file.pem |
| 471 |
.Ve |
| 472 |
.PP |
| 473 |
Don't encrypt the private key: |
| 474 |
.PP |
| 475 |
.Vb 1 |
| 476 |
\& openssl pkcs12 \-in file.p12 \-out file.pem \-noenc |
| 477 |
.Ve |
| 478 |
.PP |
| 479 |
Print some info about a PKCS#12 file: |
| 480 |
.PP |
| 481 |
.Vb 1 |
| 482 |
\& openssl pkcs12 \-in file.p12 \-info \-noout |
| 483 |
.Ve |
| 484 |
.PP |
| 485 |
Print some info about a PKCS#12 file in legacy mode: |
| 486 |
.PP |
| 487 |
.Vb 1 |
| 488 |
\& openssl pkcs12 \-in file.p12 \-info \-noout \-legacy |
| 489 |
.Ve |
| 490 |
.PP |
| 491 |
Create a PKCS#12 file from a PEM file that may contain a key and certificates: |
| 492 |
.PP |
| 493 |
.Vb 1 |
| 494 |
\& openssl pkcs12 \-export \-in file.pem \-out file.p12 \-name "My PSE" |
| 495 |
.Ve |
| 496 |
.PP |
| 497 |
Include some extra certificates: |
| 498 |
.PP |
| 499 |
.Vb 2 |
| 500 |
\& openssl pkcs12 \-export \-in file.pem \-out file.p12 \-name "My PSE" \e |
| 501 |
\& \-certfile othercerts.pem |
| 502 |
.Ve |
| 503 |
.PP |
| 504 |
Export a PKCS#12 file with data from a certificate PEM file and from a further |
| 505 |
PEM file containing a key, with default algorithms as in the legacy provider: |
| 506 |
.PP |
| 507 |
.Vb 1 |
| 508 |
\& openssl pkcs12 \-export \-in cert.pem \-inkey key.pem \-out file.p12 \-legacy |
| 509 |
.Ve |
| 510 |
.SH "SEE ALSO" |
| 511 |
.IX Header "SEE ALSO" |
| 512 |
\&\fBopenssl\fR\|(1), |
| 513 |
\&\fBopenssl\-pkcs8\fR\|(1), |
| 514 |
\&\fBossl_store\-file\fR\|(7) |
| 515 |
.SH HISTORY |
| 516 |
.IX Header "HISTORY" |
| 517 |
The \fB\-engine\fR option was deprecated in OpenSSL 3.0. |
| 518 |
The \fB\-nodes\fR option was deprecated in OpenSSL 3.0, too; use \fB\-noenc\fR instead. |
| 519 |
The \fB\-macsaltlen\fR option default changed from 8 to 16 bytes in OpenSSL 3.6. |
| 520 |
.SH COPYRIGHT |
| 521 |
.IX Header "COPYRIGHT" |
| 522 |
Copyright 2000\-2025 The OpenSSL Project Authors. All Rights Reserved. |
| 523 |
.PP |
| 524 |
Licensed under the Apache License 2.0 (the "License"). You may not use |
| 525 |
this file except in compliance with the License. You can obtain a copy |
| 526 |
in the file LICENSE in the source distribution or at |
| 527 |
<https://www.openssl.org/source/license.html>. |