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