openssl-rsa.1ossl 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263
  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-RSA 1ossl"
  58. .TH OPENSSL-RSA 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\-rsa \- RSA key processing command
  65. .SH SYNOPSIS
  66. .IX Header "SYNOPSIS"
  67. \&\fBopenssl\fR \fBrsa\fR
  68. [\fB\-help\fR]
  69. [\fB\-inform\fR \fBDER\fR|\fBPEM\fR|\fBP12\fR|\fBENGINE\fR]
  70. [\fB\-outform\fR \fBDER\fR|\fBPEM\fR]
  71. [\fB\-in\fR \fIfilename\fR|\fIuri\fR]
  72. [\fB\-passin\fR \fIarg\fR]
  73. [\fB\-out\fR \fIfilename\fR]
  74. [\fB\-passout\fR \fIarg\fR]
  75. [\fB\-aes128\fR]
  76. [\fB\-aes192\fR]
  77. [\fB\-aes256\fR]
  78. [\fB\-aria128\fR]
  79. [\fB\-aria192\fR]
  80. [\fB\-aria256\fR]
  81. [\fB\-camellia128\fR]
  82. [\fB\-camellia192\fR]
  83. [\fB\-camellia256\fR]
  84. [\fB\-des\fR]
  85. [\fB\-des3\fR]
  86. [\fB\-idea\fR]
  87. [\fB\-text\fR]
  88. [\fB\-noout\fR]
  89. [\fB\-modulus\fR]
  90. [\fB\-traditional\fR]
  91. [\fB\-check\fR]
  92. [\fB\-pubin\fR]
  93. [\fB\-pubout\fR]
  94. [\fB\-RSAPublicKey_in\fR]
  95. [\fB\-RSAPublicKey_out\fR]
  96. [\fB\-pvk\-strong\fR]
  97. [\fB\-pvk\-weak\fR]
  98. [\fB\-pvk\-none\fR]
  99. [\fB\-engine\fR \fIid\fR]
  100. [\fB\-provider\fR \fIname\fR]
  101. [\fB\-provider\-path\fR \fIpath\fR]
  102. [\fB\-propquery\fR \fIpropq\fR]
  103. .SH DESCRIPTION
  104. .IX Header "DESCRIPTION"
  105. This command processes RSA keys. They can be converted between
  106. various forms and their components printed out.
  107. .SH OPTIONS
  108. .IX Header "OPTIONS"
  109. .IP \fB\-help\fR 4
  110. .IX Item "-help"
  111. Print out a usage message.
  112. .IP "\fB\-inform\fR \fBDER\fR|\fBPEM\fR|\fBP12\fR|\fBENGINE\fR" 4
  113. .IX Item "-inform DER|PEM|P12|ENGINE"
  114. The key input format; unspecified by default.
  115. See \fBopenssl\-format\-options\fR\|(1) for details.
  116. .IP "\fB\-outform\fR \fBDER\fR|\fBPEM\fR" 4
  117. .IX Item "-outform DER|PEM"
  118. The key output format; the default is \fBPEM\fR.
  119. See \fBopenssl\-format\-options\fR\|(1) for details.
  120. .IP \fB\-traditional\fR 4
  121. .IX Item "-traditional"
  122. When writing a private key, use the traditional PKCS#1 format
  123. instead of the PKCS#8 format.
  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 or standard input if this
  127. option is not specified. If the key is encrypted a pass phrase will be
  128. prompted for.
  129. .IP "\fB\-passin\fR \fIarg\fR, \fB\-passout\fR \fIarg\fR" 4
  130. .IX Item "-passin arg, -passout arg"
  131. The password source for the input and output file.
  132. For more information about the format of \fBarg\fR
  133. see \fBopenssl\-passphrase\-options\fR\|(1).
  134. .IP "\fB\-out\fR \fIfilename\fR" 4
  135. .IX Item "-out filename"
  136. This specifies the output filename to write a key to or standard output if this
  137. option is not specified. If any encryption options are set then a pass phrase
  138. will be prompted for. The output filename should \fBnot\fR be the same as the input
  139. filename.
  140. .IP "\fB\-aes128\fR, \fB\-aes192\fR, \fB\-aes256\fR, \fB\-aria128\fR, \fB\-aria192\fR, \fB\-aria256\fR, \fB\-camellia128\fR, \fB\-camellia192\fR, \fB\-camellia256\fR, \fB\-des\fR, \fB\-des3\fR, \fB\-idea\fR" 4
  141. .IX Item "-aes128, -aes192, -aes256, -aria128, -aria192, -aria256, -camellia128, -camellia192, -camellia256, -des, -des3, -idea"
  142. These options encrypt the private key with the specified
  143. cipher before outputting it. A pass phrase is prompted for.
  144. If none of these options is specified the key is written in plain text. This
  145. means that this command can be used to remove the pass phrase from a key
  146. by not giving any encryption option is given, or to add or change the pass
  147. phrase by setting them.
  148. These options can only be used with PEM format output files.
  149. .IP \fB\-text\fR 4
  150. .IX Item "-text"
  151. Prints out the various public or private key components in
  152. plain text in addition to the encoded version.
  153. .IP \fB\-noout\fR 4
  154. .IX Item "-noout"
  155. This option prevents output of the encoded version of the key.
  156. .IP \fB\-modulus\fR 4
  157. .IX Item "-modulus"
  158. This option prints out the value of the modulus of the key.
  159. .IP \fB\-check\fR 4
  160. .IX Item "-check"
  161. This option checks the consistency of an RSA private key.
  162. .IP \fB\-pubin\fR 4
  163. .IX Item "-pubin"
  164. By default a private key is read from the input.
  165. With this option a public key is read instead.
  166. If the input contains no public key but a private key, its public part is used.
  167. .IP \fB\-pubout\fR 4
  168. .IX Item "-pubout"
  169. By default a private key is output: with this option a public
  170. key will be output instead. This option is automatically set if
  171. the input is a public key.
  172. .IP "\fB\-RSAPublicKey_in\fR, \fB\-RSAPublicKey_out\fR" 4
  173. .IX Item "-RSAPublicKey_in, -RSAPublicKey_out"
  174. Like \fB\-pubin\fR and \fB\-pubout\fR except \fBRSAPublicKey\fR format is used instead.
  175. .IP \fB\-pvk\-strong\fR 4
  176. .IX Item "-pvk-strong"
  177. Enable 'Strong' PVK encoding level (default).
  178. .IP \fB\-pvk\-weak\fR 4
  179. .IX Item "-pvk-weak"
  180. Enable 'Weak' PVK encoding level.
  181. .IP \fB\-pvk\-none\fR 4
  182. .IX Item "-pvk-none"
  183. Don't enforce PVK encoding.
  184. .IP "\fB\-engine\fR \fIid\fR" 4
  185. .IX Item "-engine id"
  186. See "Engine Options" in \fBopenssl\fR\|(1).
  187. This option is deprecated.
  188. .IP "\fB\-provider\fR \fIname\fR" 4
  189. .IX Item "-provider name"
  190. .PD 0
  191. .IP "\fB\-provider\-path\fR \fIpath\fR" 4
  192. .IX Item "-provider-path path"
  193. .IP "\fB\-propquery\fR \fIpropq\fR" 4
  194. .IX Item "-propquery propq"
  195. .PD
  196. See "Provider Options" in \fBopenssl\fR\|(1), \fBprovider\fR\|(7), and \fBproperty\fR\|(7).
  197. .SH NOTES
  198. .IX Header "NOTES"
  199. The \fBopenssl\-pkey\fR\|(1) command is capable of performing all the operations
  200. this command can, as well as supporting other public key types.
  201. .SH EXAMPLES
  202. .IX Header "EXAMPLES"
  203. The documentation for the \fBopenssl\-pkey\fR\|(1) command contains examples
  204. equivalent to the ones listed here.
  205. .PP
  206. To remove the pass phrase on an RSA private key:
  207. .PP
  208. .Vb 1
  209. \& openssl rsa \-in key.pem \-out keyout.pem
  210. .Ve
  211. .PP
  212. To encrypt a private key using triple DES:
  213. .PP
  214. .Vb 1
  215. \& openssl rsa \-in key.pem \-des3 \-out keyout.pem
  216. .Ve
  217. .PP
  218. To convert a private key from PEM to DER format:
  219. .PP
  220. .Vb 1
  221. \& openssl rsa \-in key.pem \-outform DER \-out keyout.der
  222. .Ve
  223. .PP
  224. To print out the components of a private key to standard output:
  225. .PP
  226. .Vb 1
  227. \& openssl rsa \-in key.pem \-text \-noout
  228. .Ve
  229. .PP
  230. To just output the public part of a private key:
  231. .PP
  232. .Vb 1
  233. \& openssl rsa \-in key.pem \-pubout \-out pubkey.pem
  234. .Ve
  235. .PP
  236. Output the public part of a private key in \fBRSAPublicKey\fR format:
  237. .PP
  238. .Vb 1
  239. \& openssl rsa \-in key.pem \-RSAPublicKey_out \-out pubkey.pem
  240. .Ve
  241. .SH BUGS
  242. .IX Header "BUGS"
  243. There should be an option that automatically handles \fI.key\fR files,
  244. without having to manually edit them.
  245. .SH "SEE ALSO"
  246. .IX Header "SEE ALSO"
  247. \&\fBopenssl\fR\|(1),
  248. \&\fBopenssl\-pkey\fR\|(1),
  249. \&\fBopenssl\-pkcs8\fR\|(1),
  250. \&\fBopenssl\-dsa\fR\|(1),
  251. \&\fBopenssl\-genrsa\fR\|(1),
  252. \&\fBopenssl\-gendsa\fR\|(1)
  253. .SH HISTORY
  254. .IX Header "HISTORY"
  255. The \fB\-engine\fR option was deprecated in OpenSSL 3.0.
  256. .SH COPYRIGHT
  257. .IX Header "COPYRIGHT"
  258. Copyright 2000\-2023 The OpenSSL Project Authors. All Rights Reserved.
  259. .PP
  260. Licensed under the Apache License 2.0 (the "License"). You may not use
  261. this file except in compliance with the License. You can obtain a copy
  262. in the file LICENSE in the source distribution or at
  263. <https://www.openssl.org/source/license.html>.