openssl-pkey.1ossl 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283
  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-PKEY 1ossl"
  58. .TH OPENSSL-PKEY 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\-pkey \- public or private key processing command
  65. .SH SYNOPSIS
  66. .IX Header "SYNOPSIS"
  67. \&\fBopenssl\fR \fBpkey\fR
  68. [\fB\-help\fR]
  69. [\fB\-engine\fR \fIid\fR]
  70. [\fB\-provider\fR \fIname\fR]
  71. [\fB\-provider\-path\fR \fIpath\fR]
  72. [\fB\-propquery\fR \fIpropq\fR]
  73. [\fB\-check\fR]
  74. [\fB\-pubcheck\fR]
  75. [\fB\-in\fR \fIfilename\fR|\fIuri\fR]
  76. [\fB\-inform\fR \fBDER\fR|\fBPEM\fR|\fBP12\fR|\fBENGINE\fR]
  77. [\fB\-passin\fR \fIarg\fR]
  78. [\fB\-pubin\fR]
  79. [\fB\-out\fR \fIfilename\fR]
  80. [\fB\-outform\fR \fBDER\fR|\fBPEM\fR]
  81. [\fB\-\fR\f(BIcipher\fR]
  82. [\fB\-passout\fR \fIarg\fR]
  83. [\fB\-traditional\fR]
  84. [\fB\-pubout\fR]
  85. [\fB\-noout\fR]
  86. [\fB\-text\fR]
  87. [\fB\-text_pub\fR]
  88. [\fB\-ec_conv_form\fR \fIarg\fR]
  89. [\fB\-ec_param_enc\fR \fIarg\fR]
  90. .SH DESCRIPTION
  91. .IX Header "DESCRIPTION"
  92. This command processes public or private keys. They can be
  93. converted between various forms and their components printed.
  94. .SH OPTIONS
  95. .IX Header "OPTIONS"
  96. .SS "General options"
  97. .IX Subsection "General options"
  98. .IP \fB\-help\fR 4
  99. .IX Item "-help"
  100. Print out a usage message.
  101. .IP "\fB\-engine\fR \fIid\fR" 4
  102. .IX Item "-engine id"
  103. See "Engine Options" in \fBopenssl\fR\|(1).
  104. This option is deprecated.
  105. .IP "\fB\-provider\fR \fIname\fR" 4
  106. .IX Item "-provider name"
  107. .PD 0
  108. .IP "\fB\-provider\-path\fR \fIpath\fR" 4
  109. .IX Item "-provider-path path"
  110. .IP "\fB\-propquery\fR \fIpropq\fR" 4
  111. .IX Item "-propquery propq"
  112. .PD
  113. See "Provider Options" in \fBopenssl\fR\|(1), \fBprovider\fR\|(7), and \fBproperty\fR\|(7).
  114. .IP \fB\-check\fR 4
  115. .IX Item "-check"
  116. This option checks the consistency of a key pair for both public and private
  117. components.
  118. .IP \fB\-pubcheck\fR 4
  119. .IX Item "-pubcheck"
  120. This option checks the correctness of either a public key
  121. or the public component of a key pair.
  122. .SS "Input options"
  123. .IX Subsection "Input options"
  124. .IP "\fB\-in\fR \fIfilename\fR|\fIuri\fR" 4
  125. .IX Item "-in filename|uri"
  126. This specifies the input to read a key from
  127. or standard input if this option is not specified.
  128. If the key input is encrypted and \fB\-passin\fR is not given
  129. a pass phrase will be prompted for.
  130. .IP "\fB\-inform\fR \fBDER\fR|\fBPEM\fR|\fBP12\fR|\fBENGINE\fR" 4
  131. .IX Item "-inform DER|PEM|P12|ENGINE"
  132. The key input format; unspecified by default.
  133. See \fBopenssl\-format\-options\fR\|(1) for details.
  134. .IP "\fB\-passin\fR \fIarg\fR" 4
  135. .IX Item "-passin arg"
  136. The password source for the key input.
  137. .Sp
  138. For more information about the format of \fBarg\fR
  139. see \fBopenssl\-passphrase\-options\fR\|(1).
  140. .IP \fB\-pubin\fR 4
  141. .IX Item "-pubin"
  142. By default a private key is read from the input.
  143. With this option a public key is read instead.
  144. If the input contains no public key but a private key, its public part is used.
  145. .SS "Output options"
  146. .IX Subsection "Output options"
  147. .IP "\fB\-out\fR \fIfilename\fR" 4
  148. .IX Item "-out filename"
  149. This specifies the output filename to save the encoded and/or text output of key
  150. or standard output if this option is not specified.
  151. If any cipher option is set but no \fB\-passout\fR is given
  152. then a pass phrase will be prompted for.
  153. The output filename should \fBnot\fR be the same as the input filename.
  154. .IP "\fB\-outform\fR \fBDER\fR|\fBPEM\fR" 4
  155. .IX Item "-outform DER|PEM"
  156. The key output format; the default is \fBPEM\fR.
  157. See \fBopenssl\-format\-options\fR\|(1) for details.
  158. .IP \fB\-\fR\f(BIcipher\fR 4
  159. .IX Item "-cipher"
  160. Encrypt the PEM encoded private key with the supplied cipher. Any algorithm
  161. name accepted by \fBEVP_get_cipherbyname()\fR is acceptable such as \fBaes128\fR.
  162. Encryption is not supported for DER output.
  163. .IP "\fB\-passout\fR \fIarg\fR" 4
  164. .IX Item "-passout arg"
  165. The password source for the output file.
  166. .Sp
  167. For more information about the format of \fBarg\fR
  168. see \fBopenssl\-passphrase\-options\fR\|(1).
  169. .IP \fB\-traditional\fR 4
  170. .IX Item "-traditional"
  171. Normally a private key is written using standard format: this is PKCS#8 form
  172. with the appropriate encryption algorithm (if any). If the \fB\-traditional\fR
  173. option is specified then the older "traditional" format is used instead.
  174. .IP \fB\-pubout\fR 4
  175. .IX Item "-pubout"
  176. By default the private and public key is output;
  177. this option restricts the output to the public components.
  178. This option is automatically set if the input is a public key.
  179. .Sp
  180. When combined with \fB\-text\fR, this is equivalent to \fB\-text_pub\fR.
  181. .IP \fB\-noout\fR 4
  182. .IX Item "-noout"
  183. Do not output the key in encoded form.
  184. .IP \fB\-text\fR 4
  185. .IX Item "-text"
  186. Output the various key components in plain text
  187. (possibly in addition to the PEM encoded form).
  188. This cannot be combined with encoded output in DER format.
  189. .IP \fB\-text_pub\fR 4
  190. .IX Item "-text_pub"
  191. Output in text form only the public key components (also for private keys).
  192. This cannot be combined with encoded output in DER format.
  193. .IP "\fB\-ec_conv_form\fR \fIarg\fR" 4
  194. .IX Item "-ec_conv_form arg"
  195. This option only applies to elliptic-curve based keys.
  196. .Sp
  197. This specifies how the points on the elliptic curve are converted
  198. into octet strings. Possible values are: \fBcompressed\fR (the default
  199. value), \fBuncompressed\fR and \fBhybrid\fR. For more information regarding
  200. the point conversion forms please read the X9.62 standard.
  201. \&\fBNote\fR Due to patent issues the \fBcompressed\fR option is disabled
  202. by default for binary curves and can be enabled by defining
  203. the preprocessor macro \fBOPENSSL_EC_BIN_PT_COMP\fR at compile time.
  204. .IP "\fB\-ec_param_enc\fR \fIarg\fR" 4
  205. .IX Item "-ec_param_enc arg"
  206. This option only applies to elliptic curve based public and private keys.
  207. .Sp
  208. This specifies how the elliptic curve parameters are encoded.
  209. Possible value are: \fBnamed_curve\fR, i.e. the ec parameters are
  210. specified by an OID, or \fBexplicit\fR where the ec parameters are
  211. explicitly given (see RFC 3279 for the definition of the
  212. EC parameters structures). The default value is \fBnamed_curve\fR.
  213. \&\fBNote\fR the \fBimplicitlyCA\fR alternative, as specified in RFC 3279,
  214. is currently not implemented in OpenSSL.
  215. .SH EXAMPLES
  216. .IX Header "EXAMPLES"
  217. To remove the pass phrase on a private key:
  218. .PP
  219. .Vb 1
  220. \& openssl pkey \-in key.pem \-out keyout.pem
  221. .Ve
  222. .PP
  223. To encrypt a private key using triple DES:
  224. .PP
  225. .Vb 1
  226. \& openssl pkey \-in key.pem \-des3 \-out keyout.pem
  227. .Ve
  228. .PP
  229. To convert a private key from PEM to DER format:
  230. .PP
  231. .Vb 1
  232. \& openssl pkey \-in key.pem \-outform DER \-out keyout.der
  233. .Ve
  234. .PP
  235. To print out the components of a private key to standard output:
  236. .PP
  237. .Vb 1
  238. \& openssl pkey \-in key.pem \-text \-noout
  239. .Ve
  240. .PP
  241. To print out the public components of a private key to standard output:
  242. .PP
  243. .Vb 1
  244. \& openssl pkey \-in key.pem \-text_pub \-noout
  245. .Ve
  246. .PP
  247. To just output the public part of a private key:
  248. .PP
  249. .Vb 1
  250. \& openssl pkey \-in key.pem \-pubout \-out pubkey.pem
  251. .Ve
  252. .PP
  253. To change the EC parameters encoding to \fBexplicit\fR:
  254. .PP
  255. .Vb 1
  256. \& openssl pkey \-in key.pem \-ec_param_enc explicit \-out keyout.pem
  257. .Ve
  258. .PP
  259. To change the EC point conversion form to \fBcompressed\fR:
  260. .PP
  261. .Vb 1
  262. \& openssl pkey \-in key.pem \-ec_conv_form compressed \-out keyout.pem
  263. .Ve
  264. .SH "SEE ALSO"
  265. .IX Header "SEE ALSO"
  266. \&\fBopenssl\fR\|(1),
  267. \&\fBopenssl\-genpkey\fR\|(1),
  268. \&\fBopenssl\-rsa\fR\|(1),
  269. \&\fBopenssl\-pkcs8\fR\|(1),
  270. \&\fBopenssl\-dsa\fR\|(1),
  271. \&\fBopenssl\-genrsa\fR\|(1),
  272. \&\fBopenssl\-gendsa\fR\|(1)
  273. .SH HISTORY
  274. .IX Header "HISTORY"
  275. The \fB\-engine\fR option was deprecated in OpenSSL 3.0.
  276. .SH COPYRIGHT
  277. .IX Header "COPYRIGHT"
  278. Copyright 2006\-2023 The OpenSSL Project Authors. All Rights Reserved.
  279. .PP
  280. Licensed under the Apache License 2.0 (the "License"). You may not use
  281. this file except in compliance with the License. You can obtain a copy
  282. in the file LICENSE in the source distribution or at
  283. <https://www.openssl.org/source/license.html>.