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