1EC(1) OpenSSL EC(1)
2
3
4
6 ec - EC key processing
7
9 openssl ec [-inform PEM|DER] [-outform PEM|DER] [-in filename] [-passin
10 arg] [-out filename] [-passout arg] [-des] [-des3] [-idea] [-text]
11 [-noout] [-param_out] [-pubin] [-pubout] [-conv_form arg] [-param_enc
12 arg] [-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 a OpenSSL EC private key into the
19 PKCS#8 private key format use the pkcs8 command.
20
22 -inform DER|PEM
23 This specifies the input format. The DER option with a private key
24 uses an ASN.1 DER encoded SEC1 private key. When used with a public
25 key it uses the SubjectPublicKeyInfo structure as specified in RFC
26 3280. The PEM form is the default format: it consists of the DER
27 format base64 encoded with additional header and footer lines. In
28 the case of a private key PKCS#8 format is also accepted.
29
30 -outform DER|PEM
31 This specifies the output format, the options have the same meaning
32 as the -inform option.
33
34 -in filename
35 This specifies the input filename to read a key from or standard
36 input if this option is not specified. If the key is encrypted a
37 pass phrase will be prompted for.
38
39 -passin arg
40 the input file password source. For more information about the
41 format of arg see the PASS PHRASE ARGUMENTS section in openssl(1).
42
43 -out filename
44 This specifies the output filename to write a key to or standard
45 output by is not specified. If any encryption options are set then
46 a pass phrase will be prompted for. The output filename should not
47 be the same as the input filename.
48
49 -passout arg
50 the output file password source. For more information about the
51 format of arg see the PASS PHRASE ARGUMENTS section in openssl(1).
52
53 -des|-des3|-idea
54 These options encrypt the private key with the DES, triple DES,
55 IDEA or any other cipher supported by OpenSSL before outputting it.
56 A pass phrase is prompted for. If none of these options is
57 specified the key is written in plain text. This means that using
58 the ec utility to read in an encrypted key with no encryption
59 option can be used to remove the pass phrase from a key, or by
60 setting the encryption options it can be use to add or change the
61 pass phrase. These options can only be used with PEM format output
62 files.
63
64 -text
65 prints out the public, private key components and parameters.
66
67 -noout
68 this option prevents output of the encoded version of the key.
69
70 -pubin
71 by default a private key is read from the input file: with this
72 option a public key is read instead.
73
74 -pubout
75 by default a private key is output. With this option a public key
76 will be output instead. This option is automatically set if the
77 input is a public key.
78
79 -conv_form
80 This specifies how the points on the elliptic curve are converted
81 into octet strings. Possible values are: compressed (the default
82 value), uncompressed and hybrid. For more information regarding the
83 point conversion forms please read the X9.62 standard. Note Due to
84 patent issues the compressed option is disabled by default for
85 binary curves and can be enabled by defining the preprocessor macro
86 OPENSSL_EC_BIN_PT_COMP at compile time.
87
88 -param_enc arg
89 This specifies how the elliptic curve parameters are encoded.
90 Possible value are: named_curve, i.e. the ec parameters are
91 specified by a OID, or explicit where the ec parameters are
92 explicitly given (see RFC 3279 for the definition of the EC
93 parameters structures). The default value is named_curve. Note the
94 implicitlyCA alternative ,as specified in RFC 3279, is currently
95 not implemented in OpenSSL.
96
97 -engine id
98 specifying an engine (by its unique id string) will cause ec to
99 attempt to obtain a functional reference to the specified engine,
100 thus initialising it if needed. The engine will then be set as the
101 default for all available algorithms.
102
104 The PEM private key format uses the header and footer lines:
105
106 -----BEGIN EC PRIVATE KEY-----
107 -----END EC PRIVATE KEY-----
108
109 The PEM public key format uses the header and footer lines:
110
111 -----BEGIN PUBLIC KEY-----
112 -----END PUBLIC KEY-----
113
115 To encrypt a private key using triple DES:
116
117 openssl ec -in key.pem -des3 -out keyout.pem
118
119 To convert a private key from PEM to DER format:
120
121 openssl ec -in key.pem -outform DER -out keyout.der
122
123 To print out the components of a private key to standard output:
124
125 openssl ec -in key.pem -text -noout
126
127 To just output the public part of a private key:
128
129 openssl ec -in key.pem -pubout -out pubkey.pem
130
131 To change the parameters encoding to explicit:
132
133 openssl ec -in key.pem -param_enc explicit -out keyout.pem
134
135 To change the point conversion form to compressed:
136
137 openssl ec -in key.pem -conv_form compressed -out keyout.pem
138
140 ecparam(1), dsa(1), rsa(1)
141
143 The ec command was first introduced in OpenSSL 0.9.8.
144
146 Nils Larsch for the OpenSSL project (http://www.openssl.org).
147
148
149
1501.0.2k 2019-03-12 EC(1)