rsa.html 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  1. <?xml version="1.0" ?>
  2. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  3. <html xmlns="http://www.w3.org/1999/xhtml">
  4. <head>
  5. <title>rsa</title>
  6. <meta http-equiv="content-type" content="text/html; charset=utf-8" />
  7. <link rev="made" href="mailto:root@localhost" />
  8. </head>
  9. <body>
  10. <ul id="index">
  11. <li><a href="#NAME">NAME</a></li>
  12. <li><a href="#SYNOPSIS">SYNOPSIS</a></li>
  13. <li><a href="#DESCRIPTION">DESCRIPTION</a></li>
  14. <li><a href="#OPTIONS">OPTIONS</a></li>
  15. <li><a href="#NOTES">NOTES</a></li>
  16. <li><a href="#EXAMPLES">EXAMPLES</a></li>
  17. <li><a href="#BUGS">BUGS</a></li>
  18. <li><a href="#SEE-ALSO">SEE ALSO</a></li>
  19. <li><a href="#COPYRIGHT">COPYRIGHT</a></li>
  20. </ul>
  21. <h1 id="NAME">NAME</h1>
  22. <p>openssl-rsa, rsa - RSA key processing tool</p>
  23. <h1 id="SYNOPSIS">SYNOPSIS</h1>
  24. <p><b>openssl</b> <b>rsa</b> [<b>-help</b>] [<b>-inform PEM|DER</b>] [<b>-outform PEM|DER</b>] [<b>-in filename</b>] [<b>-passin arg</b>] [<b>-out filename</b>] [<b>-passout arg</b>] [<b>-aes128</b>] [<b>-aes192</b>] [<b>-aes256</b>] [<b>-aria128</b>] [<b>-aria192</b>] [<b>-aria256</b>] [<b>-camellia128</b>] [<b>-camellia192</b>] [<b>-camellia256</b>] [<b>-des</b>] [<b>-des3</b>] [<b>-idea</b>] [<b>-text</b>] [<b>-noout</b>] [<b>-modulus</b>] [<b>-check</b>] [<b>-pubin</b>] [<b>-pubout</b>] [<b>-RSAPublicKey_in</b>] [<b>-RSAPublicKey_out</b>] [<b>-engine id</b>]</p>
  25. <h1 id="DESCRIPTION">DESCRIPTION</h1>
  26. <p>The <b>rsa</b> command processes RSA keys. They can be converted between various forms and their components printed out. <b>Note</b> this command uses the traditional SSLeay compatible format for private key encryption: newer applications should use the more secure PKCS#8 format using the <b>pkcs8</b> utility.</p>
  27. <h1 id="OPTIONS">OPTIONS</h1>
  28. <dl>
  29. <dt id="help"><b>-help</b></dt>
  30. <dd>
  31. <p>Print out a usage message.</p>
  32. </dd>
  33. <dt id="inform-DER-PEM"><b>-inform DER|PEM</b></dt>
  34. <dd>
  35. <p>This specifies the input format. The <b>DER</b> option uses an ASN1 DER encoded form compatible with the PKCS#1 RSAPrivateKey or SubjectPublicKeyInfo format. The <b>PEM</b> form is the default format: it consists of the <b>DER</b> format base64 encoded with additional header and footer lines. On input PKCS#8 format private keys are also accepted.</p>
  36. </dd>
  37. <dt id="outform-DER-PEM"><b>-outform DER|PEM</b></dt>
  38. <dd>
  39. <p>This specifies the output format, the options have the same meaning and default as the <b>-inform</b> option.</p>
  40. </dd>
  41. <dt id="in-filename"><b>-in filename</b></dt>
  42. <dd>
  43. <p>This specifies the input filename to read a key from or standard input if this option is not specified. If the key is encrypted a pass phrase will be prompted for.</p>
  44. </dd>
  45. <dt id="passin-arg"><b>-passin arg</b></dt>
  46. <dd>
  47. <p>The input file password source. For more information about the format of <b>arg</b> see <a href="../man1/openssl.html">&quot;Pass Phrase Options&quot; in openssl(1)</a>.</p>
  48. </dd>
  49. <dt id="out-filename"><b>-out filename</b></dt>
  50. <dd>
  51. <p>This specifies the output filename to write a key to or standard output if this option is not specified. If any encryption options are set then a pass phrase will be prompted for. The output filename should <b>not</b> be the same as the input filename.</p>
  52. </dd>
  53. <dt id="passout-password"><b>-passout password</b></dt>
  54. <dd>
  55. <p>The output file password source. For more information about the format of <b>arg</b> see <a href="../man1/openssl.html">&quot;Pass Phrase Options&quot; in openssl(1)</a>.</p>
  56. </dd>
  57. <dt id="aes128--aes192--aes256--aria128--aria192--aria256--camellia128--camellia192--camellia256--des--des3--idea"><b>-aes128</b>, <b>-aes192</b>, <b>-aes256</b>, <b>-aria128</b>, <b>-aria192</b>, <b>-aria256</b>, <b>-camellia128</b>, <b>-camellia192</b>, <b>-camellia256</b>, <b>-des</b>, <b>-des3</b>, <b>-idea</b></dt>
  58. <dd>
  59. <p>These options encrypt the private key with the specified cipher before outputting it. A pass phrase is prompted for. If none of these options is specified the key is written in plain text. This means that using the <b>rsa</b> utility to read in an encrypted key with no encryption option can be used to remove the pass phrase from a key, or by setting the encryption options it can be use to add or change the pass phrase. These options can only be used with PEM format output files.</p>
  60. </dd>
  61. <dt id="text"><b>-text</b></dt>
  62. <dd>
  63. <p>Prints out the various public or private key components in plain text in addition to the encoded version.</p>
  64. </dd>
  65. <dt id="noout"><b>-noout</b></dt>
  66. <dd>
  67. <p>This option prevents output of the encoded version of the key.</p>
  68. </dd>
  69. <dt id="modulus"><b>-modulus</b></dt>
  70. <dd>
  71. <p>This option prints out the value of the modulus of the key.</p>
  72. </dd>
  73. <dt id="check"><b>-check</b></dt>
  74. <dd>
  75. <p>This option checks the consistency of an RSA private key.</p>
  76. </dd>
  77. <dt id="pubin"><b>-pubin</b></dt>
  78. <dd>
  79. <p>By default a private key is read from the input file: with this option a public key is read instead.</p>
  80. </dd>
  81. <dt id="pubout"><b>-pubout</b></dt>
  82. <dd>
  83. <p>By default a private key is output: with this option a public key will be output instead. This option is automatically set if the input is a public key.</p>
  84. </dd>
  85. <dt id="RSAPublicKey_in--RSAPublicKey_out"><b>-RSAPublicKey_in</b>, <b>-RSAPublicKey_out</b></dt>
  86. <dd>
  87. <p>Like <b>-pubin</b> and <b>-pubout</b> except <b>RSAPublicKey</b> format is used instead.</p>
  88. </dd>
  89. <dt id="engine-id"><b>-engine id</b></dt>
  90. <dd>
  91. <p>Specifying an engine (by its unique <b>id</b> string) will cause <b>rsa</b> to attempt to obtain a functional reference to the specified engine, thus initialising it if needed. The engine will then be set as the default for all available algorithms.</p>
  92. </dd>
  93. </dl>
  94. <h1 id="NOTES">NOTES</h1>
  95. <p>The PEM private key format uses the header and footer lines:</p>
  96. <pre><code> -----BEGIN RSA PRIVATE KEY-----
  97. -----END RSA PRIVATE KEY-----</code></pre>
  98. <p>The PEM public key format uses the header and footer lines:</p>
  99. <pre><code> -----BEGIN PUBLIC KEY-----
  100. -----END PUBLIC KEY-----</code></pre>
  101. <p>The PEM <b>RSAPublicKey</b> format uses the header and footer lines:</p>
  102. <pre><code> -----BEGIN RSA PUBLIC KEY-----
  103. -----END RSA PUBLIC KEY-----</code></pre>
  104. <h1 id="EXAMPLES">EXAMPLES</h1>
  105. <p>To remove the pass phrase on an RSA private key:</p>
  106. <pre><code> openssl rsa -in key.pem -out keyout.pem</code></pre>
  107. <p>To encrypt a private key using triple DES:</p>
  108. <pre><code> openssl rsa -in key.pem -des3 -out keyout.pem</code></pre>
  109. <p>To convert a private key from PEM to DER format:</p>
  110. <pre><code> openssl rsa -in key.pem -outform DER -out keyout.der</code></pre>
  111. <p>To print out the components of a private key to standard output:</p>
  112. <pre><code> openssl rsa -in key.pem -text -noout</code></pre>
  113. <p>To just output the public part of a private key:</p>
  114. <pre><code> openssl rsa -in key.pem -pubout -out pubkey.pem</code></pre>
  115. <p>Output the public part of a private key in <b>RSAPublicKey</b> format:</p>
  116. <pre><code> openssl rsa -in key.pem -RSAPublicKey_out -out pubkey.pem</code></pre>
  117. <h1 id="BUGS">BUGS</h1>
  118. <p>There should be an option that automatically handles .key files, without having to manually edit them.</p>
  119. <h1 id="SEE-ALSO">SEE ALSO</h1>
  120. <p><a href="../man1/pkcs8.html">pkcs8(1)</a>, <a href="../man1/dsa.html">dsa(1)</a>, <a href="../man1/genrsa.html">genrsa(1)</a>, <a href="../man1/gendsa.html">gendsa(1)</a></p>
  121. <h1 id="COPYRIGHT">COPYRIGHT</h1>
  122. <p>Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.</p>
  123. <p>Licensed under the OpenSSL license (the &quot;License&quot;). You may not use this file except in compliance with the License. You can obtain a copy in the file LICENSE in the source distribution or at <a href="https://www.openssl.org/source/license.html">https://www.openssl.org/source/license.html</a>.</p>
  124. </body>
  125. </html>