openssl-pkcs12.1ossl 23 KB

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