pkey.html 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  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>pkey</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="#EXAMPLES">EXAMPLES</a></li>
  16. <li><a href="#SEE-ALSO">SEE ALSO</a></li>
  17. <li><a href="#COPYRIGHT">COPYRIGHT</a></li>
  18. </ul>
  19. <h1 id="NAME">NAME</h1>
  20. <p>openssl-pkey, pkey - public or private key processing tool</p>
  21. <h1 id="SYNOPSIS">SYNOPSIS</h1>
  22. <p><b>openssl</b> <b>pkey</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>-traditional</b>] [<b>-<i>cipher</i></b>] [<b>-text</b>] [<b>-text_pub</b>] [<b>-noout</b>] [<b>-pubin</b>] [<b>-pubout</b>] [<b>-engine id</b>] [<b>-check</b>] [<b>-pubcheck</b>]</p>
  23. <h1 id="DESCRIPTION">DESCRIPTION</h1>
  24. <p>The <b>pkey</b> command processes public or private keys. They can be converted between various forms and their components printed out.</p>
  25. <h1 id="OPTIONS">OPTIONS</h1>
  26. <dl>
  27. <dt id="help"><b>-help</b></dt>
  28. <dd>
  29. <p>Print out a usage message.</p>
  30. </dd>
  31. <dt id="inform-DER-PEM"><b>-inform DER|PEM</b></dt>
  32. <dd>
  33. <p>This specifies the input format DER or PEM. The default format is PEM.</p>
  34. </dd>
  35. <dt id="outform-DER-PEM"><b>-outform DER|PEM</b></dt>
  36. <dd>
  37. <p>This specifies the output format, the options have the same meaning and default as the <b>-inform</b> option.</p>
  38. </dd>
  39. <dt id="in-filename"><b>-in filename</b></dt>
  40. <dd>
  41. <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>
  42. </dd>
  43. <dt id="passin-arg"><b>-passin arg</b></dt>
  44. <dd>
  45. <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>
  46. </dd>
  47. <dt id="out-filename"><b>-out filename</b></dt>
  48. <dd>
  49. <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>
  50. </dd>
  51. <dt id="passout-password"><b>-passout password</b></dt>
  52. <dd>
  53. <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>
  54. </dd>
  55. <dt id="traditional"><b>-traditional</b></dt>
  56. <dd>
  57. <p>Normally a private key is written using standard format: this is PKCS#8 form with the appropriate encryption algorithm (if any). If the <b>-traditional</b> option is specified then the older &quot;traditional&quot; format is used instead.</p>
  58. </dd>
  59. <dt id="cipher"><b>-<i>cipher</i></b></dt>
  60. <dd>
  61. <p>These options encrypt the private key with the supplied cipher. Any algorithm name accepted by EVP_get_cipherbyname() is acceptable such as <b>des3</b>.</p>
  62. </dd>
  63. <dt id="text"><b>-text</b></dt>
  64. <dd>
  65. <p>Prints out the various public or private key components in plain text in addition to the encoded version.</p>
  66. </dd>
  67. <dt id="text_pub"><b>-text_pub</b></dt>
  68. <dd>
  69. <p>Print out only public key components even if a private key is being processed.</p>
  70. </dd>
  71. <dt id="noout"><b>-noout</b></dt>
  72. <dd>
  73. <p>Do not output the encoded version of the key.</p>
  74. </dd>
  75. <dt id="pubin"><b>-pubin</b></dt>
  76. <dd>
  77. <p>By default a private key is read from the input file: with this option a public key is read instead.</p>
  78. </dd>
  79. <dt id="pubout"><b>-pubout</b></dt>
  80. <dd>
  81. <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>
  82. </dd>
  83. <dt id="engine-id"><b>-engine id</b></dt>
  84. <dd>
  85. <p>Specifying an engine (by its unique <b>id</b> string) will cause <b>pkey</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>
  86. </dd>
  87. <dt id="check"><b>-check</b></dt>
  88. <dd>
  89. <p>This option checks the consistency of a key pair for both public and private components.</p>
  90. </dd>
  91. <dt id="pubcheck"><b>-pubcheck</b></dt>
  92. <dd>
  93. <p>This option checks the correctness of either a public key or the public component of a key pair.</p>
  94. </dd>
  95. </dl>
  96. <h1 id="EXAMPLES">EXAMPLES</h1>
  97. <p>To remove the pass phrase on an RSA private key:</p>
  98. <pre><code> openssl pkey -in key.pem -out keyout.pem</code></pre>
  99. <p>To encrypt a private key using triple DES:</p>
  100. <pre><code> openssl pkey -in key.pem -des3 -out keyout.pem</code></pre>
  101. <p>To convert a private key from PEM to DER format:</p>
  102. <pre><code> openssl pkey -in key.pem -outform DER -out keyout.der</code></pre>
  103. <p>To print out the components of a private key to standard output:</p>
  104. <pre><code> openssl pkey -in key.pem -text -noout</code></pre>
  105. <p>To print out the public components of a private key to standard output:</p>
  106. <pre><code> openssl pkey -in key.pem -text_pub -noout</code></pre>
  107. <p>To just output the public part of a private key:</p>
  108. <pre><code> openssl pkey -in key.pem -pubout -out pubkey.pem</code></pre>
  109. <h1 id="SEE-ALSO">SEE ALSO</h1>
  110. <p><a href="../man1/genpkey.html">genpkey(1)</a>, <a href="../man1/rsa.html">rsa(1)</a>, <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>
  111. <h1 id="COPYRIGHT">COPYRIGHT</h1>
  112. <p>Copyright 2006-2021 The OpenSSL Project Authors. All Rights Reserved.</p>
  113. <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>
  114. </body>
  115. </html>