ec.pod 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207
  1. =pod
  2. =head1 NAME
  3. openssl-ec,
  4. ec - EC key processing
  5. =head1 SYNOPSIS
  6. B<openssl> B<ec>
  7. [B<-help>]
  8. [B<-inform PEM|DER>]
  9. [B<-outform PEM|DER>]
  10. [B<-in filename>]
  11. [B<-passin arg>]
  12. [B<-out filename>]
  13. [B<-passout arg>]
  14. [B<-des>]
  15. [B<-des3>]
  16. [B<-idea>]
  17. [B<-text>]
  18. [B<-noout>]
  19. [B<-param_out>]
  20. [B<-pubin>]
  21. [B<-pubout>]
  22. [B<-conv_form arg>]
  23. [B<-param_enc arg>]
  24. [B<-no_public>]
  25. [B<-check>]
  26. [B<-engine id>]
  27. =head1 DESCRIPTION
  28. The B<ec> command processes EC keys. They can be converted between various
  29. forms and their components printed out. B<Note> OpenSSL uses the
  30. private key format specified in 'SEC 1: Elliptic Curve Cryptography'
  31. (http://www.secg.org/). To convert an OpenSSL EC private key into the
  32. PKCS#8 private key format use the B<pkcs8> command.
  33. =head1 OPTIONS
  34. =over 4
  35. =item B<-help>
  36. Print out a usage message.
  37. =item B<-inform DER|PEM>
  38. This specifies the input format. The B<DER> option with a private key uses
  39. an ASN.1 DER encoded SEC1 private key. When used with a public key it
  40. uses the SubjectPublicKeyInfo structure as specified in RFC 3280.
  41. The B<PEM> form is the default format: it consists of the B<DER> format base64
  42. encoded with additional header and footer lines. In the case of a private key
  43. PKCS#8 format is also accepted.
  44. =item B<-outform DER|PEM>
  45. This specifies the output format, the options have the same meaning and default
  46. as the B<-inform> option.
  47. =item B<-in filename>
  48. This specifies the input filename to read a key from or standard input if this
  49. option is not specified. If the key is encrypted a pass phrase will be
  50. prompted for.
  51. =item B<-passin arg>
  52. The input file password source. For more information about the format of B<arg>
  53. see the B<PASS PHRASE ARGUMENTS> section in L<openssl(1)>.
  54. =item B<-out filename>
  55. This specifies the output filename to write a key to or standard output by
  56. is not specified. If any encryption options are set then a pass phrase will be
  57. prompted for. The output filename should B<not> be the same as the input
  58. filename.
  59. =item B<-passout arg>
  60. The output file password source. For more information about the format of B<arg>
  61. see the B<PASS PHRASE ARGUMENTS> section in L<openssl(1)>.
  62. =item B<-des|-des3|-idea>
  63. These options encrypt the private key with the DES, triple DES, IDEA or
  64. any other cipher supported by OpenSSL before outputting it. A pass phrase is
  65. prompted for.
  66. If none of these options is specified the key is written in plain text. This
  67. means that using the B<ec> utility to read in an encrypted key with no
  68. encryption option can be used to remove the pass phrase from a key, or by
  69. setting the encryption options it can be use to add or change the pass phrase.
  70. These options can only be used with PEM format output files.
  71. =item B<-text>
  72. Prints out the public, private key components and parameters.
  73. =item B<-noout>
  74. This option prevents output of the encoded version of the key.
  75. =item B<-modulus>
  76. This option prints out the value of the public key component of the key.
  77. =item B<-pubin>
  78. By default, a private key is read from the input file. With this option a
  79. public key is read instead.
  80. =item B<-pubout>
  81. By default a private key is output. With this option a public
  82. key will be output instead. This option is automatically set if the input is
  83. a public key.
  84. =item B<-conv_form>
  85. This specifies how the points on the elliptic curve are converted
  86. into octet strings. Possible values are: B<compressed> (the default
  87. value), B<uncompressed> and B<hybrid>. For more information regarding
  88. the point conversion forms please read the X9.62 standard.
  89. B<Note> Due to patent issues the B<compressed> option is disabled
  90. by default for binary curves and can be enabled by defining
  91. the preprocessor macro B<OPENSSL_EC_BIN_PT_COMP> at compile time.
  92. =item B<-param_enc arg>
  93. This specifies how the elliptic curve parameters are encoded.
  94. Possible value are: B<named_curve>, i.e. the ec parameters are
  95. specified by an OID, or B<explicit> where the ec parameters are
  96. explicitly given (see RFC 3279 for the definition of the
  97. EC parameters structures). The default value is B<named_curve>.
  98. B<Note> the B<implicitlyCA> alternative, as specified in RFC 3279,
  99. is currently not implemented in OpenSSL.
  100. =item B<-no_public>
  101. This option omits the public key components from the private key output.
  102. =item B<-check>
  103. This option checks the consistency of an EC private or public key.
  104. =item B<-engine id>
  105. Specifying an engine (by its unique B<id> string) will cause B<ec>
  106. to attempt to obtain a functional reference to the specified engine,
  107. thus initialising it if needed. The engine will then be set as the default
  108. for all available algorithms.
  109. =back
  110. =head1 NOTES
  111. The PEM private key format uses the header and footer lines:
  112. -----BEGIN EC PRIVATE KEY-----
  113. -----END EC PRIVATE KEY-----
  114. The PEM public key format uses the header and footer lines:
  115. -----BEGIN PUBLIC KEY-----
  116. -----END PUBLIC KEY-----
  117. =head1 EXAMPLES
  118. To encrypt a private key using triple DES:
  119. openssl ec -in key.pem -des3 -out keyout.pem
  120. To convert a private key from PEM to DER format:
  121. openssl ec -in key.pem -outform DER -out keyout.der
  122. To print out the components of a private key to standard output:
  123. openssl ec -in key.pem -text -noout
  124. To just output the public part of a private key:
  125. openssl ec -in key.pem -pubout -out pubkey.pem
  126. To change the parameters encoding to B<explicit>:
  127. openssl ec -in key.pem -param_enc explicit -out keyout.pem
  128. To change the point conversion form to B<compressed>:
  129. openssl ec -in key.pem -conv_form compressed -out keyout.pem
  130. =head1 SEE ALSO
  131. L<ecparam(1)>, L<dsa(1)>, L<rsa(1)>
  132. =head1 COPYRIGHT
  133. Copyright 2003-2017 The OpenSSL Project Authors. All Rights Reserved.
  134. Licensed under the OpenSSL license (the "License"). You may not use
  135. this file except in compliance with the License. You can obtain a copy
  136. in the file LICENSE in the source distribution or at
  137. L<https://www.openssl.org/source/license.html>.
  138. =cut