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