openssl-pkcs12.1ossl 20 KB

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