ec.html 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  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>ec</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="#SEE-ALSO">SEE ALSO</a></li>
  18. <li><a href="#COPYRIGHT">COPYRIGHT</a></li>
  19. </ul>
  20. <h1 id="NAME">NAME</h1>
  21. <p>openssl-ec, ec - EC key processing</p>
  22. <h1 id="SYNOPSIS">SYNOPSIS</h1>
  23. <p><b>openssl</b> <b>ec</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>-des</b>] [<b>-des3</b>] [<b>-idea</b>] [<b>-text</b>] [<b>-noout</b>] [<b>-param_out</b>] [<b>-pubin</b>] [<b>-pubout</b>] [<b>-conv_form arg</b>] [<b>-param_enc arg</b>] [<b>-no_public</b>] [<b>-check</b>] [<b>-engine id</b>]</p>
  24. <h1 id="DESCRIPTION">DESCRIPTION</h1>
  25. <p>The <b>ec</b> command processes EC keys. They can be converted between various forms and their components printed out. <b>Note</b> OpenSSL uses the private key format specified in &#39;SEC 1: Elliptic Curve Cryptography&#39; (http://www.secg.org/). To convert an OpenSSL EC private key into the PKCS#8 private key format use the <b>pkcs8</b> command.</p>
  26. <h1 id="OPTIONS">OPTIONS</h1>
  27. <dl>
  28. <dt id="help"><b>-help</b></dt>
  29. <dd>
  30. <p>Print out a usage message.</p>
  31. </dd>
  32. <dt id="inform-DER-PEM"><b>-inform DER|PEM</b></dt>
  33. <dd>
  34. <p>This specifies the input format. The <b>DER</b> option with a private key uses an ASN.1 DER encoded SEC1 private key. When used with a public key it uses the SubjectPublicKeyInfo structure as specified in RFC 3280. 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. In the case of a private key PKCS#8 format is also accepted.</p>
  35. </dd>
  36. <dt id="outform-DER-PEM"><b>-outform DER|PEM</b></dt>
  37. <dd>
  38. <p>This specifies the output format, the options have the same meaning and default as the <b>-inform</b> option.</p>
  39. </dd>
  40. <dt id="in-filename"><b>-in filename</b></dt>
  41. <dd>
  42. <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>
  43. </dd>
  44. <dt id="passin-arg"><b>-passin arg</b></dt>
  45. <dd>
  46. <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>
  47. </dd>
  48. <dt id="out-filename"><b>-out filename</b></dt>
  49. <dd>
  50. <p>This specifies the output filename to write a key to or standard output by 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>
  51. </dd>
  52. <dt id="passout-arg"><b>-passout arg</b></dt>
  53. <dd>
  54. <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>
  55. </dd>
  56. <dt id="des--des3--idea"><b>-des|-des3|-idea</b></dt>
  57. <dd>
  58. <p>These options encrypt the private key with the DES, triple DES, IDEA or any other cipher supported by OpenSSL 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>ec</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>
  59. </dd>
  60. <dt id="text"><b>-text</b></dt>
  61. <dd>
  62. <p>Prints out the public, private key components and parameters.</p>
  63. </dd>
  64. <dt id="noout"><b>-noout</b></dt>
  65. <dd>
  66. <p>This option prevents output of the encoded version of the key.</p>
  67. </dd>
  68. <dt id="pubin"><b>-pubin</b></dt>
  69. <dd>
  70. <p>By default, a private key is read from the input file. With this option a public key is read instead.</p>
  71. </dd>
  72. <dt id="pubout"><b>-pubout</b></dt>
  73. <dd>
  74. <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>
  75. </dd>
  76. <dt id="conv_form"><b>-conv_form</b></dt>
  77. <dd>
  78. <p>This specifies how the points on the elliptic curve are converted into octet strings. Possible values are: <b>compressed</b> (the default value), <b>uncompressed</b> and <b>hybrid</b>. For more information regarding the point conversion forms please read the X9.62 standard. <b>Note</b> Due to patent issues the <b>compressed</b> option is disabled by default for binary curves and can be enabled by defining the preprocessor macro <b>OPENSSL_EC_BIN_PT_COMP</b> at compile time.</p>
  79. </dd>
  80. <dt id="param_enc-arg"><b>-param_enc arg</b></dt>
  81. <dd>
  82. <p>This specifies how the elliptic curve parameters are encoded. Possible value are: <b>named_curve</b>, i.e. the ec parameters are specified by an OID, or <b>explicit</b> where the ec parameters are explicitly given (see RFC 3279 for the definition of the EC parameters structures). The default value is <b>named_curve</b>. <b>Note</b> the <b>implicitlyCA</b> alternative, as specified in RFC 3279, is currently not implemented in OpenSSL.</p>
  83. </dd>
  84. <dt id="no_public"><b>-no_public</b></dt>
  85. <dd>
  86. <p>This option omits the public key components from the private key output.</p>
  87. </dd>
  88. <dt id="check"><b>-check</b></dt>
  89. <dd>
  90. <p>This option checks the consistency of an EC private or public key.</p>
  91. </dd>
  92. <dt id="engine-id"><b>-engine id</b></dt>
  93. <dd>
  94. <p>Specifying an engine (by its unique <b>id</b> string) will cause <b>ec</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>
  95. </dd>
  96. </dl>
  97. <h1 id="NOTES">NOTES</h1>
  98. <p>The PEM private key format uses the header and footer lines:</p>
  99. <pre><code> -----BEGIN EC PRIVATE KEY-----
  100. -----END EC PRIVATE KEY-----</code></pre>
  101. <p>The PEM public key format uses the header and footer lines:</p>
  102. <pre><code> -----BEGIN PUBLIC KEY-----
  103. -----END PUBLIC KEY-----</code></pre>
  104. <h1 id="EXAMPLES">EXAMPLES</h1>
  105. <p>To encrypt a private key using triple DES:</p>
  106. <pre><code> openssl ec -in key.pem -des3 -out keyout.pem</code></pre>
  107. <p>To convert a private key from PEM to DER format:</p>
  108. <pre><code> openssl ec -in key.pem -outform DER -out keyout.der</code></pre>
  109. <p>To print out the components of a private key to standard output:</p>
  110. <pre><code> openssl ec -in key.pem -text -noout</code></pre>
  111. <p>To just output the public part of a private key:</p>
  112. <pre><code> openssl ec -in key.pem -pubout -out pubkey.pem</code></pre>
  113. <p>To change the parameters encoding to <b>explicit</b>:</p>
  114. <pre><code> openssl ec -in key.pem -param_enc explicit -out keyout.pem</code></pre>
  115. <p>To change the point conversion form to <b>compressed</b>:</p>
  116. <pre><code> openssl ec -in key.pem -conv_form compressed -out keyout.pem</code></pre>
  117. <h1 id="SEE-ALSO">SEE ALSO</h1>
  118. <p><a href="../man1/ecparam.html">ecparam(1)</a>, <a href="../man1/dsa.html">dsa(1)</a>, <a href="../man1/rsa.html">rsa(1)</a></p>
  119. <h1 id="COPYRIGHT">COPYRIGHT</h1>
  120. <p>Copyright 2003-2021 The OpenSSL Project Authors. All Rights Reserved.</p>
  121. <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>
  122. </body>
  123. </html>