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