]>
Commit | Line | Data |
---|---|---|
2c789c82 BM |
1 | =pod |
2 | ||
3 | =head1 NAME | |
4 | ||
5 | ec - EC key processing | |
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 | ||
1bc74519 | 58 | This specifies the output format, the options have the same meaning as the |
2c789c82 BM |
59 | B<-inform> option. |
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 | ||
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 | ||
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 | ||
97 | prints out the public, private key components and parameters. | |
98 | ||
99 | =item B<-noout> | |
100 | ||
101 | this option prevents output of the encoded version of the key. | |
102 | ||
103 | =item B<-modulus> | |
104 | ||
105 | this option prints out the value of the public key component of the key. | |
106 | ||
107 | =item B<-pubin> | |
108 | ||
109 | by default a private key is read from the input file: with this option a | |
110 | public key is read instead. | |
111 | ||
112 | =item B<-pubout> | |
113 | ||
114 | by default a private key is output. With this option a public | |
115 | key will be output instead. This option is automatically set if the input is | |
116 | a public key. | |
117 | ||
118 | =item B<-conv_form> | |
119 | ||
120 | This specifies how the points on the elliptic curve are converted | |
121 | into octet strings. Possible values are: B<compressed> (the default | |
122 | value), B<uncompressed> and B<hybrid>. For more information regarding | |
123 | the point conversion forms please read the X9.62 standard. | |
124 | B<Note> Due to patent issues the B<compressed> option is disabled | |
125 | by default for binary curves and can be enabled by defining | |
126 | the preprocessor macro B<OPENSSL_EC_BIN_PT_COMP> at compile time. | |
127 | ||
128 | =item B<-param_enc arg> | |
129 | ||
130 | This specifies how the elliptic curve parameters are encoded. | |
131 | Possible value are: B<named_curve>, i.e. the ec parameters are | |
35ed393e | 132 | specified by an OID, or B<explicit> where the ec parameters are |
1bc74519 | 133 | explicitly given (see RFC 3279 for the definition of the |
2c789c82 | 134 | EC parameters structures). The default value is B<named_curve>. |
aebb9aac | 135 | B<Note> the B<implicitlyCA> alternative, as specified in RFC 3279, |
2c789c82 BM |
136 | is currently not implemented in OpenSSL. |
137 | ||
16754806 DSH |
138 | =item B<-no_public> |
139 | ||
140 | This option omits the public key components from the private key output. | |
141 | ||
7565cbc4 DSH |
142 | =item B<-check> |
143 | ||
144 | this option checks the consistency of an EC private or public key. | |
145 | ||
2c789c82 BM |
146 | =item B<-engine id> |
147 | ||
e5fa864f | 148 | specifying an engine (by its unique B<id> string) will cause B<ec> |
2c789c82 BM |
149 | to attempt to obtain a functional reference to the specified engine, |
150 | thus initialising it if needed. The engine will then be set as the default | |
151 | for all available algorithms. | |
152 | ||
153 | =back | |
154 | ||
155 | =head1 NOTES | |
156 | ||
157 | The PEM private key format uses the header and footer lines: | |
158 | ||
159 | -----BEGIN EC PRIVATE KEY----- | |
160 | -----END EC PRIVATE KEY----- | |
161 | ||
162 | The PEM public key format uses the header and footer lines: | |
163 | ||
164 | -----BEGIN PUBLIC KEY----- | |
165 | -----END PUBLIC KEY----- | |
166 | ||
167 | =head1 EXAMPLES | |
168 | ||
169 | To encrypt a private key using triple DES: | |
170 | ||
171 | openssl ec -in key.pem -des3 -out keyout.pem | |
172 | ||
1bc74519 | 173 | To convert a private key from PEM to DER format: |
2c789c82 BM |
174 | |
175 | openssl ec -in key.pem -outform DER -out keyout.der | |
176 | ||
177 | To print out the components of a private key to standard output: | |
178 | ||
179 | openssl ec -in key.pem -text -noout | |
180 | ||
181 | To just output the public part of a private key: | |
182 | ||
183 | openssl ec -in key.pem -pubout -out pubkey.pem | |
184 | ||
185 | To change the parameters encoding to B<explicit>: | |
186 | ||
187 | openssl ec -in key.pem -param_enc explicit -out keyout.pem | |
188 | ||
189 | To change the point conversion form to B<compressed>: | |
190 | ||
191 | openssl ec -in key.pem -conv_form compressed -out keyout.pem | |
192 | ||
193 | =head1 SEE ALSO | |
194 | ||
9b86974e | 195 | L<ecparam(1)>, L<dsa(1)>, L<rsa(1)> |
2c789c82 | 196 | |
e2f92610 RS |
197 | =head1 COPYRIGHT |
198 | ||
199 | Copyright 2003-2016 The OpenSSL Project Authors. All Rights Reserved. | |
200 | ||
201 | Licensed under the OpenSSL license (the "License"). You may not use | |
202 | this file except in compliance with the License. You can obtain a copy | |
203 | in the file LICENSE in the source distribution or at | |
204 | L<https://www.openssl.org/source/license.html>. | |
205 | ||
206 | =cut |