{
    "mode": "man",
    "parameter": "openssl-pkcs12",
    "section": "1",
    "url": "https://www.chedong.com/phpMan.php/man/openssl-pkcs12/1/json",
    "generated": "2026-08-14T03:25:28Z",
    "synopsis": "openssl pkcs12 [-help] [-passin arg] [-passout arg] [-password arg] [-twopass] [-in\nfilename|uri] [-out filename] [-nokeys] [-nocerts] [-noout] [-legacy] [-engine id] [-provider\nname] [-provider-path path] [-propquery propq] [-rand files] [-writerand file]\nPKCS#12 input (parsing) options: [-info] [-nomacver] [-clcerts] [-cacerts]\n[-aes128] [-aes192] [-aes256] [-aria128] [-aria192] [-aria256] [-camellia128] [-camellia192]\n[-camellia256] [-des] [-des3] [-idea] [-noenc] [-nodes]\nPKCS#12 output (export) options:\n[-export] [-inkey filename|uri] [-certfile filename] [-passcerts arg] [-chain] [-untrusted\nfilename] [-CAfile file] [-no-CAfile] [-CApath dir] [-no-CApath] [-CAstore uri] [-no-CAstore]\n[-name name] [-caname name] [-CSP name] [-LMK] [-keyex] [-keysig] [-keypbe cipher] [-certpbe\ncipher] [-descert] [-macalg digest] [-iter count] [-noiter] [-nomaciter] [-maciter] [-nomac]",
    "sections": {
        "NAME": {
            "content": "openssl-pkcs12 - PKCS#12 file command\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "openssl pkcs12 [-help] [-passin arg] [-passout arg] [-password arg] [-twopass] [-in\nfilename|uri] [-out filename] [-nokeys] [-nocerts] [-noout] [-legacy] [-engine id] [-provider\nname] [-provider-path path] [-propquery propq] [-rand files] [-writerand file]\n\nPKCS#12 input (parsing) options: [-info] [-nomacver] [-clcerts] [-cacerts]\n\n[-aes128] [-aes192] [-aes256] [-aria128] [-aria192] [-aria256] [-camellia128] [-camellia192]\n[-camellia256] [-des] [-des3] [-idea] [-noenc] [-nodes]\n\nPKCS#12 output (export) options:\n\n[-export] [-inkey filename|uri] [-certfile filename] [-passcerts arg] [-chain] [-untrusted\nfilename] [-CAfile file] [-no-CAfile] [-CApath dir] [-no-CApath] [-CAstore uri] [-no-CAstore]\n[-name name] [-caname name] [-CSP name] [-LMK] [-keyex] [-keysig] [-keypbe cipher] [-certpbe\ncipher] [-descert] [-macalg digest] [-iter count] [-noiter] [-nomaciter] [-maciter] [-nomac]\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "This command allows PKCS#12 files (sometimes referred to as PFX files) to be created and\nparsed. PKCS#12 files are used by several programs including Netscape, MSIE and MS Outlook.\n",
            "subsections": []
        },
        "OPTIONS": {
            "content": "There are a lot of options the meaning of some depends of whether a PKCS#12 file is being\ncreated or parsed. By default a PKCS#12 file is parsed.  A PKCS#12 file can be created by\nusing the -export option (see below).  The PKCS#12 export encryption and MAC options such as",
            "subsections": [
                {
                    "name": "-certpbe  -iter  -chain  -export",
                    "content": "Conversely, the options regarding encryption of private keys when outputting PKCS#12 input\nare relevant only when the -export option is not given.\n\nThe default encryption algorithm is AES-256-CBC with PBKDF2 for key derivation.\n\nWhen encountering problems loading legacy PKCS#12 files that involve, for example,\nRC2-40-CBC, try using the -legacy option and, if needed, the -provider-path option.\n"
                },
                {
                    "name": "-help",
                    "content": "Print out a usage message.\n"
                },
                {
                    "name": "-passin _",
                    "content": "The  password  source for the input, and for encrypting any private keys that are output.\nFor more information about the format of arg see openssl-passphrase-options(1).\n"
                },
                {
                    "name": "-passout _",
                    "content": "The password source for output files.\n"
                },
                {
                    "name": "-password _",
                    "content": "With -export, -password is equivalent to -passout, otherwise it is equivalent to -passin.\n"
                },
                {
                    "name": "-twopass",
                    "content": "Prompt for separate integrity and encryption  passwords:  most  software  always  assumes\nthese  are  the  same so this option will render such PKCS#12 files unreadable. Cannot be\nused in combination with the options -password, -passin if  importing  from  PKCS#12,  or\n-passout if exporting.\n"
                },
                {
                    "name": "-nokeys",
                    "content": "No private keys will be output.\n"
                },
                {
                    "name": "-nocerts",
                    "content": "No certificates will be output.\n"
                },
                {
                    "name": "-noout",
                    "content": "This option inhibits all credentials output, and so the input is just verified.\n"
                },
                {
                    "name": "-legacy",
                    "content": "Use  legacy  mode of operation and automatically load the legacy provider.  If OpenSSL is\nnot installed system-wide, it is necessary to  also  use,  for  example,  \"-provider-path\n./providers\" or to set the environment variable OPENSSLMODULES to point to the directory\nwhere the providers can be found.\n\nIn  the  legacy  mode,  the  default  algorithm  for certificate encryption is RC2CBC or\n3DESCBC depending on whether the RC2  cipher  is  enabled  in  the  build.  The  default\nalgorithm for private key encryption is 3DESCBC.  If the legacy option is not specified,\nthen  the  legacy  provider  is  not loaded and the default encryption algorithm for both\ncertificates and private keys is AES256CBC with PBKDF2 for key derivation.\n"
                },
                {
                    "name": "-engine _",
                    "content": "See \"Engine Options\" in openssl(1).  This option is deprecated.\n"
                },
                {
                    "name": "-provider _",
                    "content": ""
                },
                {
                    "name": "-provider-path _",
                    "content": ""
                },
                {
                    "name": "-propquery _",
                    "content": "See \"Provider Options\" in openssl(1), provider(7), and property(7).\n"
                },
                {
                    "name": "-rand _ -writerand _",
                    "content": "See \"Random State Options\" in openssl(1) for details.\n"
                },
                {
                    "name": "PKCS#12 input (parsing) options",
                    "content": ""
                },
                {
                    "name": "-in _",
                    "content": "This specifies the input filename or URI.  Standard input is used  by  default.   Without\nthe  -export  option  this  must  be PKCS#12 file to be parsed.  For use with the -export\noption see the \"PKCS#12 output (export) options\" section.\n"
                },
                {
                    "name": "-out _",
                    "content": "The filename to write certificates and private keys to, standard output by default.  They\nare all written in PEM format.\n"
                },
                {
                    "name": "-info",
                    "content": "Output additional information about the  PKCS#12  file  structure,  algorithms  used  and\niteration counts.\n"
                },
                {
                    "name": "-nomacver",
                    "content": "Don't attempt to verify the integrity MAC.\n"
                },
                {
                    "name": "-clcerts",
                    "content": "Only output client certificates (not CA certificates).\n"
                },
                {
                    "name": "-cacerts",
                    "content": "Only output CA certificates (not client certificates).\n"
                },
                {
                    "name": "-aes128 -aes192 -aes256",
                    "content": "Use AES to encrypt private keys before outputting.\n"
                },
                {
                    "name": "-aria128 -aria192 -aria256",
                    "content": "Use ARIA to encrypt private keys before outputting.\n"
                },
                {
                    "name": "-camellia128 -camellia192 -camellia256",
                    "content": "Use Camellia to encrypt private keys before outputting.\n"
                },
                {
                    "name": "-des",
                    "content": "Use DES to encrypt private keys before outputting.\n"
                },
                {
                    "name": "-des3",
                    "content": "Use triple DES to encrypt private keys before outputting.\n"
                },
                {
                    "name": "-idea",
                    "content": "Use IDEA to encrypt private keys before outputting.\n"
                },
                {
                    "name": "-noenc",
                    "content": "Don't encrypt private keys at all.\n"
                },
                {
                    "name": "-nodes",
                    "content": "This option is deprecated since OpenSSL 3.0; use -noenc instead.\n"
                },
                {
                    "name": "PKCS#12 output (export) options",
                    "content": ""
                },
                {
                    "name": "-export",
                    "content": "This option specifies that a PKCS#12 file will be created rather than parsed.\n"
                },
                {
                    "name": "-out _",
                    "content": "This specifies filename to write the PKCS#12 file to. Standard output is used by default.\n"
                },
                {
                    "name": "-in _",
                    "content": "This  specifies  the input filename or URI.  Standard input is used by default.  With the\n-export option this is a file with certificates and a key, or a URI that refers to a  key\naccessed  via  an  engine.   The  order  of  credentials in a file doesn't matter but one\nprivate  key  and  its  corresponding  certificate  should  be  present.  If   additional\ncertificates are present they will also be included in the PKCS#12 output file.\n"
                },
                {
                    "name": "-inkey _",
                    "content": "The  private key input for PKCS12 output.  If this option is not specified then the input\nfile (-in argument) must contain a private key.  If no engine is used,  the  argument  is\ntaken   as   a   file.    If   the   -engine  option  is  used  or  the  URI  has  prefix\n\"org.openssl.engine:\" then the rest of the URI is taken as key identifier for  the  given\nengine.\n"
                },
                {
                    "name": "-certfile _",
                    "content": "An  input  file  with extra certificates to be added to the PKCS#12 output if the -export\noption is given.\n"
                },
                {
                    "name": "-passcerts _",
                    "content": "The password source for certificate input such as -certfile  and  -untrusted.   For  more\ninformation about the format of arg see openssl-passphrase-options(1).\n"
                },
                {
                    "name": "-chain",
                    "content": "If  this  option  is  present then the certificate chain of the end entity certificate is\nbuilt and included in the PKCS#12 output file.  The end entity certificate is  the  first\none  read  from  the -in file if no key is given, else the first certificate matching the\ngiven key.  The standard CA trust store is used  for  chain  building,  as  well  as  any\nuntrusted CA certificates given with the -untrusted option.\n"
                },
                {
                    "name": "-untrusted _",
                    "content": "An  input  file  of  untrusted certificates that may be used for chain building, which is\nrelevant only when a PKCS#12 file is created with  the  -export  option  and  the  -chain\noption  is given as well.  Any certificates that are actually part of the chain are added\nto the output.\n"
                },
                {
                    "name": "-CAfile _ -no-CAfile -CApath _ -no-CApath -CAstore _ -no-CAstore",
                    "content": "See \"Trusted Certificate Options\" in openssl-verification-options(1) for details.\n"
                },
                {
                    "name": "-name _",
                    "content": "This specifies the \"friendly name\" for the certificates and private  key.  This  name  is\ntypically displayed in list boxes by software importing the file.\n"
                },
                {
                    "name": "-caname _",
                    "content": "This  specifies  the  \"friendly  name\"  for  other  certificates. This option may be used\nmultiple times to specify names for all certificates in the order they  appear.  Netscape\nignores friendly names on other certificates whereas MSIE displays them.\n"
                },
                {
                    "name": "-CSP _",
                    "content": "Write  name  as  a  Microsoft  CSP  name.   The  password  source  for the input, and for\nencrypting any private keys that are output.  For more information about  the  format  of\narg see openssl-passphrase-options(1).\n"
                },
                {
                    "name": "-LMK",
                    "content": "Add the \"Local Key Set\" identifier to the attributes.\n"
                },
                {
                    "name": "-keyex -keysig",
                    "content": "Specifies  that  the  private  key  is to be used for key exchange or just signing.  This\noption is only interpreted by MSIE and  similar  MS  software.  Normally  \"export  grade\"\nsoftware  will  only  allow  512  bit  RSA  keys  to  be used for encryption purposes but\narbitrary length keys for signing. The -keysig option marks the  key  for  signing  only.\nSigning  only keys can be used for S/MIME signing, authenticode (ActiveX control signing)\nand SSL client authentication, however, due to a bug only MSIE 5.0 and later support  the\nuse of signing only keys for SSL client authentication.\n"
                },
                {
                    "name": "-keypbe _ -certpbe _",
                    "content": "These  options allow the algorithm used to encrypt the private key and certificates to be\nselected. Any PKCS#5 v1.5 or PKCS#12 PBE algorithm name can be used (see \"NOTES\"  section\nfor  more information). If a cipher name (as output by \"openssl list -cipher-algorithms\")\nis specified then it is used  with  PKCS#5  v2.0.  For  interoperability  reasons  it  is\nadvisable to only use PKCS#12 algorithms.\n\nSpecial value \"NONE\" disables encryption of the private key and certificates.\n"
                },
                {
                    "name": "-descert",
                    "content": "Encrypt  the  certificates  using  triple  DES.  By  default  the  private  key  and  the\ncertificates are encrypted using AES-256-CBC unless the  '-legacy'  option  is  used.  If\n'-descert' is used with the '-legacy' then both, the private key and the certificates are\nencrypted using triple DES.\n"
                },
                {
                    "name": "-macalg _",
                    "content": "Specify the MAC digest algorithm. If not included SHA256 will be used.\n"
                },
                {
                    "name": "-iter _",
                    "content": "This  option  specifies  the  iteration count for the encryption key and MAC. The default\nvalue is 2048.\n\nTo discourage attacks by using large dictionaries of common passwords the algorithm  that\nderives  keys  from  passwords  can  have an iteration count applied to it: this causes a\ncertain part of the algorithm to be repeated and slows it down. The MAC is used to  check\nthe  file  integrity  but  since  it will normally have the same password as the keys and\ncertificates it could also be attacked.\n"
                },
                {
                    "name": "-noiter -nomaciter",
                    "content": "By default both encryption and MAC iteration counts are set to 2048, using these  options\nthe  MAC  and  encryption  iteration  counts can be set to 1, since this reduces the file\nsecurity you should not use these options  unless  you  really  have  to.  Most  software\nsupports  both  MAC  and  encryption  iteration  counts.   MSIE  4.0  doesn't support MAC\niteration counts so it needs the -nomaciter option.\n"
                },
                {
                    "name": "-maciter",
                    "content": "This option is included for compatibility with previous versions, it used to be needed to\nuse MAC iterations counts but they are now used by default.\n"
                },
                {
                    "name": "-nomac",
                    "content": "Do not attempt to provide the MAC integrity. This can be useful with the FIPS provider as\nthe PKCS12 MAC requires PKCS12KDF which is not an approved FIPS algorithm and  cannot  be\nsupported by the FIPS provider.\n"
                }
            ]
        },
        "NOTES": {
            "content": "Although  there  are a large number of options most of them are very rarely used. For PKCS#12\nfile parsing only -in and -out need to be used for PKCS#12 file creation  -export  and  -name\nare also used.\n\nIf  none of the -clcerts, -cacerts or -nocerts options are present then all certificates will\nbe output in the order they appear in the input PKCS#12 files. There is no guarantee that the\nfirst certificate present is the one corresponding to  the  private  key.   Certain  software\nwhich  tries  to  get  a  private key and the corresponding certificate might assume that the\nfirst certificate in the file is the one corresponding to the private key, but that  may  not\nalways be the case.  Using the -clcerts option will solve this problem by only outputting the\ncertificate  corresponding  to the private key. If the CA certificates are required then they\ncan be output to a separate file using  the  -nokeys  -cacerts  options  to  just  output  CA\ncertificates.\n\nThe  -keypbe and -certpbe algorithms allow the precise encryption algorithms for private keys\nand certificates to be specified. Normally the defaults are fine  but  occasionally  software\ncan't  handle  triple DES encrypted private keys, then the option -keypbe PBE-SHA1-RC2-40 can\nbe used to reduce the private key encryption to 40 bit RC2. A  complete  description  of  all\nalgorithms is contained in openssl-pkcs8(1).\n\nPrior  1.1  release  passwords  containing non-ASCII characters were encoded in non-compliant\nmanner, which limited  interoperability,  in  first  hand  with  Windows.  But  switching  to\nstandard-compliant  password  encoding poses problem accessing old data protected with broken\nencoding. For this reason even legacy encodings is attempted when reading the  data.  If  you\nuse  PKCS#12  files  in  production  application you are advised to convert the data, because\nimplemented heuristic approach is not MT-safe, its  sole  goal  is  to  facilitate  the  data\nupgrade with this command.\n",
            "subsections": []
        },
        "EXAMPLES": {
            "content": "Parse a PKCS#12 file and output it to a PEM file:\n\nopenssl pkcs12 -in file.p12 -out file.pem\n\nOutput only client certificates to a file:\n\nopenssl pkcs12 -in file.p12 -clcerts -out file.pem\n\nDon't encrypt the private key:\n\nopenssl pkcs12 -in file.p12 -out file.pem -noenc\n\nPrint some info about a PKCS#12 file:\n\nopenssl pkcs12 -in file.p12 -info -noout\n\nPrint some info about a PKCS#12 file in legacy mode:\n\nopenssl pkcs12 -in file.p12 -info -noout -legacy\n\nCreate a PKCS#12 file from a PEM file that may contain a key and certificates:\n\nopenssl pkcs12 -export -in file.pem -out file.p12 -name \"My PSE\"\n\nInclude some extra certificates:\n\nopenssl pkcs12 -export -in file.pem -out file.p12 -name \"My PSE\" \\\n-certfile othercerts.pem\n\nExport  a  PKCS#12  file  with  data  from a certificate PEM file and from a further PEM file\ncontaining a key, with default algorithms as in the legacy provider:\n\nopenssl pkcs12 -export -in cert.pem -inkey key.pem -out file.p12 -legacy\n",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "openssl(1), openssl-pkcs8(1), osslstore-file(7)\n",
            "subsections": []
        },
        "HISTORY": {
            "content": "The -engine option was deprecated in OpenSSL  3.0.   The  -nodes  option  was  deprecated  in\nOpenSSL 3.0, too; use -noenc instead.\n",
            "subsections": []
        },
        "COPYRIGHT": {
            "content": "Copyright 2000-2022 The OpenSSL Project Authors. All Rights Reserved.\n\nLicensed  under  the Apache License 2.0 (the \"License\").  You may not use this file except in\ncompliance with the License.  You can obtain a  copy  in  the  file  LICENSE  in  the  source\ndistribution or at <https://www.openssl.org/source/license.html>.\n\n3.0.13                                       2026-07-29                         OPENSSL-PKCS12(1SSL)",
            "subsections": []
        }
    },
    "summary": "openssl-pkcs12 - PKCS#12 file command",
    "flags": [
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "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 AES-256-CBC with PBKDF2 for key derivation. When encountering problems loading legacy PKCS#12 files that involve, for example, RC2-40-CBC, try using the -legacy option and, if needed, the -provider-path option."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "Print out a usage message."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "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)."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "The password source for output files."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "With -export, -password is equivalent to -passout, otherwise it is equivalent to -passin."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "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 -password, -passin if importing from PKCS#12, or -passout if exporting."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "No private keys will be output."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "No certificates will be output."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "This option inhibits all credentials output, and so the input is just verified."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "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, \"-provider-path ./providers\" or to set the environment variable OPENSSLMODULES to point to the directory where the providers can be found. In the legacy mode, the default algorithm for certificate encryption is RC2CBC or 3DESCBC depending on whether the RC2 cipher is enabled in the build. The default algorithm for private key encryption is 3DESCBC. 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 AES256CBC with PBKDF2 for key derivation."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "See \"Engine Options\" in openssl(1). This option is deprecated."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": ""
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": ""
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "See \"Provider Options\" in openssl(1), provider(7), and property(7)."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "See \"Random State Options\" in openssl(1) for details."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "This specifies the input filename or URI. 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 \"PKCS#12 output (export) options\" section."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "The filename to write certificates and private keys to, standard output by default. They are all written in PEM format."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "Output additional information about the PKCS#12 file structure, algorithms used and iteration counts."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "Don't attempt to verify the integrity MAC."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "Only output client certificates (not CA certificates)."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "Only output CA certificates (not client certificates)."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "Use AES to encrypt private keys before outputting."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "Use ARIA to encrypt private keys before outputting."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "Use Camellia to encrypt private keys before outputting."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "Use DES to encrypt private keys before outputting."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "Use triple DES to encrypt private keys before outputting."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "Use IDEA to encrypt private keys before outputting."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "Don't encrypt private keys at all."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "This option is deprecated since OpenSSL 3.0; use -noenc instead."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "This option specifies that a PKCS#12 file will be created rather than parsed."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "This specifies filename to write the PKCS#12 file to. Standard output is used by default."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "This specifies the input filename or URI. Standard input is used by default. With the -export option this is a file with certificates and a key, or a URI 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."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "The private key input for PKCS12 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 URI has prefix \"org.openssl.engine:\" then the rest of the URI is taken as key identifier for the given engine."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "An input file with extra certificates to be added to the PKCS#12 output if the -export option is given."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "The password source for certificate input such as -certfile and -untrusted. For more information about the format of arg see openssl-passphrase-options(1)."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "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 CA trust store is used for chain building, as well as any untrusted CA certificates given with the -untrusted option."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "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."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "See \"Trusted Certificate Options\" in openssl-verification-options(1) for details."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "This specifies the \"friendly name\" for the certificates and private key. This name is typically displayed in list boxes by software importing the file."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "This specifies the \"friendly name\" 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 MSIE displays them."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "Write name as a Microsoft CSP 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)."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "Add the \"Local Key Set\" identifier to the attributes."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "Specifies that the private key is to be used for key exchange or just signing. This option is only interpreted by MSIE and similar MS software. Normally \"export grade\" software will only allow 512 bit RSA 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 SSL client authentication, however, due to a bug only MSIE 5.0 and later support the use of signing only keys for SSL client authentication."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "These options allow the algorithm used to encrypt the private key and certificates to be selected. Any PKCS#5 v1.5 or PKCS#12 PBE algorithm name can be used (see \"NOTES\" section for more information). If a cipher name (as output by \"openssl list -cipher-algorithms\") is specified then it is used with PKCS#5 v2.0. For interoperability reasons it is advisable to only use PKCS#12 algorithms. Special value \"NONE\" disables encryption of the private key and certificates."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "Encrypt the certificates using triple DES. By default the private key and the certificates are encrypted using AES-256-CBC 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 DES."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "Specify the MAC digest algorithm. If not included SHA256 will be used."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "This option specifies the iteration count for the encryption key and MAC. The default value is 2048. 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 MAC 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."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "By default both encryption and MAC iteration counts are set to 2048, using these options the MAC 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 MAC and encryption iteration counts. MSIE 4.0 doesn't support MAC iteration counts so it needs the -nomaciter option."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "This option is included for compatibility with previous versions, it used to be needed to use MAC iterations counts but they are now used by default."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "Do not attempt to provide the MAC integrity. This can be useful with the FIPS provider as the PKCS12 MAC requires PKCS12KDF which is not an approved FIPS algorithm and cannot be supported by the FIPS provider."
        }
    ],
    "examples": [
        "Parse a PKCS#12 file and output it to a PEM file:",
        "openssl pkcs12 -in file.p12 -out file.pem",
        "Output only client certificates to a file:",
        "openssl pkcs12 -in file.p12 -clcerts -out file.pem",
        "Don't encrypt the private key:",
        "openssl pkcs12 -in file.p12 -out file.pem -noenc",
        "Print some info about a PKCS#12 file:",
        "openssl pkcs12 -in file.p12 -info -noout",
        "Print some info about a PKCS#12 file in legacy mode:",
        "openssl pkcs12 -in file.p12 -info -noout -legacy",
        "Create a PKCS#12 file from a PEM file that may contain a key and certificates:",
        "openssl pkcs12 -export -in file.pem -out file.p12 -name \"My PSE\"",
        "Include some extra certificates:",
        "openssl pkcs12 -export -in file.pem -out file.p12 -name \"My PSE\" \\",
        "-certfile othercerts.pem",
        "Export  a  PKCS#12  file  with  data  from a certificate PEM file and from a further PEM file",
        "containing a key, with default algorithms as in the legacy provider:",
        "openssl pkcs12 -export -in cert.pem -inkey key.pem -out file.p12 -legacy"
    ],
    "see_also": [
        {
            "name": "openssl",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/openssl/1/json"
        },
        {
            "name": "openssl-pkcs8",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/openssl-pkcs8/1/json"
        },
        {
            "name": "osslstore-file",
            "section": "7",
            "url": "https://www.chedong.com/phpMan.php/man/osslstore-file/7/json"
        }
    ]
}