Automatically generated by Pod::Man 4.14 (Pod::Simple 3.42) Standard preamble: ========================================================================..
..
..
Set up some character translations and predefined strings. \*(-- will give an unbreakable dash, \*(PI will give pi, \*(L" will give a left double quote, and \*(R" will give a right double quote. \*(C+ will give a nicer C++. Capital omega is used to do unbreakable dashes and therefore won't be available. \*(C` and \*(C' expand to `' in nroff, nothing in troff, for use with C<>..tr \(*W-
. ds -- \(*W-
. ds PI pi
. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
. ds L" ""
. ds R" ""
. ds C` ""
. ds C' ""
'br\}
. ds -- \|\(em\|
. ds PI \(*p
. ds L" ``
. ds R" ''
. ds C`
. ds C'
'br\}
Escape single quotes in literal strings from groff's Unicode transform. If the F register is >0, we'll generate index entries on stderr for titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index entries marked with X<> in POD. Of course, you'll have to process the output yourself in some meaningful fashion. Avoid warning from groff about undefined register 'F'...
.nr rF 0
. if \nF \{\
. de IX
. tm Index:\\$1\t\\n%\t"\\$2"
..
. if !\nF==2 \{\
. nr % 0
. nr F 2
. \}
. \}
.\}
.rr rF
Fear. Run. Save yourself. No user-serviceable parts.. \" fudge factors for nroff and troff
. ds #H 0
. ds #V .8m
. ds #F .3m
. ds #[ \f1
. ds #]
.\}
. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
. ds #V .6m
. ds #F 0
. ds #[ \&
. ds #] \&
.\}
. \" simple accents for nroff and troff
. ds ' \&
. ds ` \&
. ds ^ \&
. ds , \&
. ds ~ ~
. ds /
.\}
. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
.\}
. \" troff and (daisy-wheel) nroff accents
. \" corrections for vroff
. \" for low resolution devices (crt and lpr)
\{\
. ds : e
. ds 8 ss
. ds o a
. ds d- d\h'-1'\(ga
. ds D- D\h'-1'\(hy
. ds th \o'bp'
. ds Th \o'LP'
. ds ae ae
. ds Ae AE
.\}
======================================================================== Title "OPENSSL-PKCS12 1ossl" OPENSSL-PKCS12 1ossl "2023-09-22" "3.0.11" "OpenSSL"
For nroff, turn off justification. Always turn off hyphenation; it makes way too many mistakes in technical documents. "NAME"
openssl-pkcs12 - PKCS#12 file command
"SYNOPSIS"
Header "SYNOPSIS" \fBopenssl
pkcs12
[
-help]
[
-passin arg]
[
-passout arg]
[
-password arg]
[
-twopass]
[
-in filename|
uri]
[
-out filename]
[
-nokeys]
[
-nocerts]
[
-noout]
[
-legacy]
[
-engine id]
[
-provider name]
[
-provider-path path]
[
-propquery propq]
[
-rand files]
[
-writerand file]
PKCS#12 input (parsing) options:
[-info]
[-nomacver]
[-clcerts]
[-cacerts]
[-aes128]
[-aes192]
[-aes256]
[-aria128]
[-aria192]
[-aria256]
[-camellia128]
[-camellia192]
[-camellia256]
[-des]
[-des3]
[-idea]
[-noenc]
[-nodes]
PKCS#12 output (export) options:
[-export]
[-inkey filename|uri]
[-certfile filename]
[-passcerts arg]
[-chain]
[-untrusted filename]
[-CAfile file]
[-no-CAfile]
[-CApath dir]
[-no-CApath]
[-CAstore uri]
[-no-CAstore]
[-name name]
[-caname name]
[-CSP name]
[-LMK]
[-keyex]
[-keysig]
[-keypbe cipher]
[-certpbe cipher]
[-descert]
[-macalg digest]
[-iter count]
[-noiter]
[-nomaciter]
[-maciter]
[-nomac]
"DESCRIPTION"
Header "DESCRIPTION" This command allows PKCS#12 files (sometimes referred to as
\s-1PFX\s0 files) to be created and parsed. PKCS#12 files are used by several
programs including Netscape, \s-1MSIE\s0 and \s-1MS\s0 Outlook.
"OPTIONS"
Header "OPTIONS" There are a lot of options the meaning of some depends of whether a PKCS#12 file
is being created or parsed. By default a PKCS#12 file is parsed.
A PKCS#12 file can be created by using the
-export option (see below).
The PKCS#12 export encryption and \s-1MAC\s0 options such as
-certpbe and
-iter
and many further options such as
-chain are relevant only with
-export.
Conversely, the options regarding encryption of private keys when outputting
PKCS#12 input are relevant only when the
-export option is not given.
The default encryption algorithm is \s-1AES-256-CBC\s0 with \s-1PBKDF2\s0 for key derivation.
When encountering problems loading legacy PKCS#12 files that involve,
for example, \s-1RC2-40-CBC,\s0
try using the -legacy option and, if needed, the -provider-path option.
"-help" 4
Item "-help" Print out a usage message.
"-passin arg" 4
Item "-passin arg" The password source for the input, and for encrypting any private keys that
are output.
For more information about the format of
arg
see
openssl-passphrase-options\|(1).
"-passout arg" 4
Item "-passout arg" The password source for output files.
"-password arg" 4
Item "-password arg" With
-export,
-password is equivalent to
-passout,
otherwise it is equivalent to
-passin.
"-twopass" 4
Item "-twopass" Prompt for separate integrity and encryption passwords: most software
always assumes these are the same so this option will render such
PKCS#12 files unreadable. Cannot be used in combination with the options
\fB-password,
-passin if importing from PKCS#12, or
-passout if exporting.
"-nokeys" 4
Item "-nokeys" No private keys will be output.
"-nocerts" 4
Item "-nocerts" No certificates will be output.
"-noout" 4
Item "-noout" This option inhibits all credentials output,
and so the input is just verified.
"-legacy" 4
Item "-legacy" Use legacy mode of operation and automatically load the legacy provider.
If OpenSSL is not installed system-wide,
it is necessary to also use, for example,
\*(C`-provider-path ./providers\*(C'
or to set the environment variable
\s-1OPENSSL_MODULES\s0
to point to the directory where the providers can be found.
.Sp
In the legacy mode, the default algorithm for certificate encryption
is \s-1RC2_CBC\s0 or 3DES_CBC depending on whether the \s-1RC2\s0 cipher is enabled
in the build. The default algorithm for private key encryption is 3DES_CBC.
If the legacy option is not specified, then the legacy provider is not loaded
and the default encryption algorithm for both certificates and private keys is
\s-1AES_256_CBC\s0 with \s-1PBKDF2\s0 for key derivation.
"-engine id" 4
Item "-engine id" See \*(L"Engine Options\*(R" in
openssl\|(1).
This option is deprecated.
"-provider name" 4
Item "-provider name" 0
"-provider-path path" 4
Item "-provider-path path" "-propquery propq" 4
Item "-propquery propq"
See \*(L"Provider Options\*(R" in openssl\|(1), provider\|(7), and property\|(7).
"-rand files, -writerand file" 4
Item "-rand files, -writerand file" See \*(L"Random State Options\*(R" in
openssl\|(1) for details.
"PKCS#12 input (parsing) options"
Subsection "PKCS#12 input (parsing) options" "-in filename|uri" 4
Item "-in filename|uri" This specifies the input filename or \s-1URI.\s0
Standard input is used by default.
Without the
-export option this must be PKCS#12 file to be parsed.
For use with the
-export option
see the \*(L"PKCS#12 output (export) options\*(R" section.
"-out filename" 4
Item "-out filename" The filename to write certificates and private keys to, standard output by
default. They are all written in \s-1PEM\s0 format.
"-info" 4
Item "-info" Output additional information about the PKCS#12 file structure, algorithms
used and iteration counts.
"-nomacver" 4
Item "-nomacver" Don't attempt to verify the integrity \s-1MAC.\s0
"-clcerts" 4
Item "-clcerts" Only output client certificates (not \s-1CA\s0 certificates).
"-cacerts" 4
Item "-cacerts" Only output \s-1CA\s0 certificates (not client certificates).
"-aes128, -aes192, -aes256" 4
Item "-aes128, -aes192, -aes256" Use \s-1AES\s0 to encrypt private keys before outputting.
"-aria128, -aria192, -aria256" 4
Item "-aria128, -aria192, -aria256" Use \s-1ARIA\s0 to encrypt private keys before outputting.
"-camellia128, -camellia192, -camellia256" 4
Item "-camellia128, -camellia192, -camellia256" Use Camellia to encrypt private keys before outputting.
"-des" 4
Item "-des" Use \s-1DES\s0 to encrypt private keys before outputting.
"-des3" 4
Item "-des3" Use triple \s-1DES\s0 to encrypt private keys before outputting.
"-idea" 4
Item "-idea" Use \s-1IDEA\s0 to encrypt private keys before outputting.
"-noenc" 4
Item "-noenc" Don't encrypt private keys at all.
"-nodes" 4
Item "-nodes" This option is deprecated since OpenSSL 3.0; use
-noenc instead.
"PKCS#12 output (export) options"
Subsection "PKCS#12 output (export) options" "-export" 4
Item "-export" This option specifies that a PKCS#12 file will be created rather than
parsed.
"-out filename" 4
Item "-out filename" This specifies filename to write the PKCS#12 file to. Standard output is used
by default.
"-in filename|uri" 4
Item "-in filename|uri" This specifies the input filename or \s-1URI.\s0
Standard input is used by default.
With the
-export option this is a file with certificates and a key,
or a \s-1URI\s0 that refers to a key accessed via an engine.
The order of credentials in a file doesn't matter but one private key and
its corresponding certificate should be present. If additional
certificates are present they will also be included in the PKCS#12 output file.
"-inkey filename|uri" 4
Item "-inkey filename|uri" The private key input for \s-1PKCS12\s0 output.
If this option is not specified then the input file (
-in argument) must
contain a private key.
If no engine is used, the argument is taken as a file.
If the
-engine option is used or the \s-1URI\s0 has prefix
\*(C`org.openssl.engine:\*(C'
then the rest of the \s-1URI\s0 is taken as key identifier for the given engine.
"-certfile filename" 4
Item "-certfile filename" An input file with extra certificates to be added to the PKCS#12 output
if the
-export option is given.
"-passcerts arg" 4
Item "-passcerts arg" The password source for certificate input such as
-certfile
and
-untrusted.
For more information about the format of
arg see
\fBopenssl-passphrase-options\|(1).
"-chain" 4
Item "-chain" If this option is present then the certificate chain of the end entity
certificate is built and included in the PKCS#12 output file.
The end entity certificate is the first one read from the
-in file
if no key is given, else the first certificate matching the given key.
The standard \s-1CA\s0 trust store is used for chain building,
as well as any untrusted \s-1CA\s0 certificates given with the
-untrusted option.
"-untrusted filename" 4
Item "-untrusted filename" An input file of untrusted certificates that may be used
for chain building, which is relevant only when a PKCS#12 file is created
with the
-export option and the
-chain option is given as well.
Any certificates that are actually part of the chain are added to the output.
"-CAfile file, -no-CAfile, -CApath dir, -no-CApath, -CAstore uri, -no-CAstore" 4
Item "-CAfile file, -no-CAfile, -CApath dir, -no-CApath, -CAstore uri, -no-CAstore" See \*(L"Trusted Certificate Options\*(R" in
openssl-verification-options\|(1) for details.
"-name friendlyname" 4
Item "-name friendlyname" This specifies the \*(L"friendly name\*(R" for the certificates and private key. This
name is typically displayed in list boxes by software importing the file.
"-caname friendlyname" 4
Item "-caname friendlyname" This specifies the \*(L"friendly name\*(R" for other certificates. This option may be
used multiple times to specify names for all certificates in the order they
appear. Netscape ignores friendly names on other certificates whereas \s-1MSIE\s0
displays them.
"-CSP name" 4
Item "-CSP name" Write
name as a Microsoft \s-1CSP\s0 name.
The password source for the input, and for encrypting any private keys that
are output.
For more information about the format of
arg
see
openssl-passphrase-options\|(1).
"-LMK" 4
Item "-LMK" Add the \*(L"Local Key Set\*(R" identifier to the attributes.
"-keyex|-keysig" 4
Item "-keyex|-keysig" Specifies that the private key is to be used for key exchange or just signing.
This option is only interpreted by \s-1MSIE\s0 and similar \s-1MS\s0 software. Normally
\*(L"export grade\*(R" software will only allow 512 bit \s-1RSA\s0 keys to be used for
encryption purposes but arbitrary length keys for signing. The
-keysig
option marks the key for signing only. Signing only keys can be used for
S/
MIME signing, authenticode (ActiveX control signing) and \s-1SSL\s0 client
authentication, however, due to a bug only \s-1MSIE 5.0\s0 and later support
the use of signing only keys for \s-1SSL\s0 client authentication.
"-keypbe alg, -certpbe alg" 4
Item "-keypbe alg, -certpbe alg" These options allow the algorithm used to encrypt the private key and
certificates to be selected. Any PKCS#5 v1.5 or PKCS#12 \s-1PBE\s0 algorithm name
can be used (see \*(L"\s-1NOTES\*(R"\s0 section for more information). If a cipher name
(as output by
\*(C`openssl list -cipher-algorithms\*(C') is specified then it
is used with PKCS#5 v2.0. For interoperability reasons it is advisable to only
use PKCS#12 algorithms.
.Sp
Special value
\*(C`NONE\*(C' disables encryption of the private key and certificates.
"-descert" 4
Item "-descert" Encrypt the certificates using triple \s-1DES.\s0 By default the private
key and the certificates are encrypted using \s-1AES-256-CBC\s0 unless
the '-legacy' option is used. If '-descert' is used with the '-legacy'
then both, the private key and the certificates are encrypted using triple \s-1DES.\s0
"-macalg digest" 4
Item "-macalg digest" Specify the \s-1MAC\s0 digest algorithm. If not included \s-1SHA256\s0 will be used.
"-iter count" 4
Item "-iter count" This option specifies the iteration count for the encryption key and \s-1MAC.\s0 The
default value is 2048.
.Sp
To discourage attacks by using large dictionaries of common passwords the
algorithm that derives keys from passwords can have an iteration count applied
to it: this causes a certain part of the algorithm to be repeated and slows it
down. The \s-1MAC\s0 is used to check the file integrity but since it will normally
have the same password as the keys and certificates it could also be attacked.
"-noiter, -nomaciter" 4
Item "-noiter, -nomaciter" By default both encryption and \s-1MAC\s0 iteration counts are set to 2048, using
these options the \s-1MAC\s0 and encryption iteration counts can be set to 1, since
this reduces the file security you should not use these options unless you
really have to. Most software supports both \s-1MAC\s0 and encryption iteration counts.
\s-1MSIE 4.0\s0 doesn't support \s-1MAC\s0 iteration counts so it needs the
-nomaciter
option.
"-maciter" 4
Item "-maciter" This option is included for compatibility with previous versions, it used
to be needed to use \s-1MAC\s0 iterations counts but they are now used by default.
"-nomac" 4
Item "-nomac" Do not attempt to provide the \s-1MAC\s0 integrity. This can be useful with the \s-1FIPS\s0
provider as the \s-1PKCS12 MAC\s0 requires \s-1PKCS12KDF\s0 which is not an approved \s-1FIPS\s0
algorithm and cannot be supported by the \s-1FIPS\s0 provider.
"NOTES"
Header "NOTES" Although there are a large number of options most of them are very rarely
used. For PKCS#12 file parsing only
-in and
-out need to be used
for PKCS#12 file creation
-export and
-name are also used.
If none of the -clcerts, -cacerts or -nocerts options are present
then all certificates will be output in the order they appear in the input
PKCS#12 files. There is no guarantee that the first certificate present is
the one corresponding to the private key.
Certain software which tries to get a private key and the corresponding
certificate might assume that the first certificate in the file is the one
corresponding to the private key, but that may not always be the case.
Using the -clcerts option will solve this problem by only
outputting the certificate corresponding to the private key. If the \s-1CA\s0
certificates are required then they can be output to a separate file using
the -nokeys -cacerts options to just output \s-1CA\s0 certificates.
The -keypbe and -certpbe algorithms allow the precise encryption
algorithms for private keys and certificates to be specified. Normally
the defaults are fine but occasionally software can't handle triple \s-1DES\s0
encrypted private keys, then the option -keypbe \s-1PBE-SHA1-RC2-40\s0 can
be used to reduce the private key encryption to 40 bit \s-1RC2. A\s0 complete
description of all algorithms is contained in openssl-pkcs8\|(1).
Prior 1.1 release passwords containing non-ASCII characters were encoded
in non-compliant manner, which limited interoperability, in first hand
with Windows. But switching to standard-compliant password encoding
poses problem accessing old data protected with broken encoding. For
this reason even legacy encodings is attempted when reading the
data. If you use PKCS#12 files in production application you are advised
to convert the data, because implemented heuristic approach is not
MT-safe, its sole goal is to facilitate the data upgrade with this
command.
"EXAMPLES"
Header "EXAMPLES" Parse a PKCS#12 file and output it to a \s-1PEM\s0 file:
.Vb 1
openssl pkcs12 -in file.p12 -out file.pem
.Ve
Output only client certificates to a file:
.Vb 1
openssl pkcs12 -in file.p12 -clcerts -out file.pem
.Ve
Don't encrypt the private key:
.Vb 1
openssl pkcs12 -in file.p12 -out file.pem -noenc
.Ve
Print some info about a PKCS#12 file:
.Vb 1
openssl pkcs12 -in file.p12 -info -noout
.Ve
Print some info about a PKCS#12 file in legacy mode:
.Vb 1
openssl pkcs12 -in file.p12 -info -noout -legacy
.Ve
Create a PKCS#12 file from a \s-1PEM\s0 file that may contain a key and certificates:
.Vb 1
openssl pkcs12 -export -in file.pem -out file.p12 -name "My PSE"
.Ve
Include some extra certificates:
.Vb 2
openssl pkcs12 -export -in file.pem -out file.p12 -name "My PSE" \e
-certfile othercerts.pem
.Ve
Export a PKCS#12 file with data from a certificate \s-1PEM\s0 file and from a further
\s-1PEM\s0 file containing a key, with default algorithms as in the legacy provider:
.Vb 1
openssl pkcs12 -export -in cert.pem -inkey key.pem -out file.p12 -legacy
.Ve
"SEE ALSO"
Header "SEE ALSO" \fBopenssl\|(1),
\fBopenssl-pkcs8\|(1),
\fBossl_store-file\|(7)
"HISTORY"
Header "HISTORY" The
-engine option was deprecated in OpenSSL 3.0.
The
-nodes option was deprecated in OpenSSL 3.0, too; use
-noenc instead.
"COPYRIGHT"
Header "COPYRIGHT" Copyright 2000-2022 The OpenSSL Project Authors. All Rights Reserved.
Licensed under the Apache License 2.0 (the \*(L"License\*(R"). You may not use
this file except in compliance with the License. You can obtain a copy
in the file \s-1LICENSE\s0 in the source distribution or at
<https://www.openssl.org/source/license.html>.