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