5 openssl-ec - EC key processing
11 [B<-inform> B<DER>|B<PEM>]
12 [B<-outform> B<DER>|B<PEM>]
25 [B<-conv_form> I<arg>]
26 [B<-param_enc> I<arg>]
31 =for openssl ifdef engine
35 The L<openssl-ec(1)> command processes EC keys. They can be converted between
36 various forms and their components printed out. B<Note> OpenSSL uses the
37 private key format specified in 'SEC 1: Elliptic Curve Cryptography'
38 (http://www.secg.org/). To convert an OpenSSL EC private key into the
39 PKCS#8 private key format use the L<openssl-pkcs8(1)> command.
47 Print out a usage message.
49 =item B<-inform> B<DER>|B<PEM>, B<-outform> B<DER>|B<PEM>
51 The input and formats; the default is B<PEM>.
52 See L<openssl(1)/Format Options> for details.
54 Private keys are an SEC1 private key or PKCS#8 format.
55 Public keys are a B<SubjectPublicKeyInfo> as specified in IETF RFC 3280.
57 =item B<-in> I<filename>
59 This specifies the input filename to read a key from or standard input if this
60 option is not specified. If the key is encrypted a pass phrase will be
63 =item B<-out> I<filename>
65 This specifies the output filename to write a key to or standard output by
66 is not specified. If any encryption options are set then a pass phrase will be
67 prompted for. The output filename should B<not> be the same as the input
70 =item B<-passin> I<arg>, B<-passout> I<arg>
72 The password source for the input and output file.
73 For more information about the format of B<arg>
74 see L<openssl(1)/Pass Phrase Options>.
76 =item B<-des>|B<-des3>|B<-idea>
78 These options encrypt the private key with the DES, triple DES, IDEA or
79 any other cipher supported by OpenSSL before outputting it. A pass phrase is
81 If none of these options is specified the key is written in plain text. This
82 means that using this command to read in an encrypted key with no
83 encryption option can be used to remove the pass phrase from a key, or by
84 setting the encryption options it can be use to add or change the pass phrase.
85 These options can only be used with PEM format output files.
89 Prints out the public, private key components and parameters.
93 This option prevents output of the encoded version of the key.
97 By default, a private key is read from the input file. With this option a
98 public key is read instead.
102 By default a private key is output. With this option a public
103 key will be output instead. This option is automatically set if the input is
106 =item B<-conv_form> I<arg>
108 This specifies how the points on the elliptic curve are converted
109 into octet strings. Possible values are: B<compressed> (the default
110 value), B<uncompressed> and B<hybrid>. For more information regarding
111 the point conversion forms please read the X9.62 standard.
112 B<Note> Due to patent issues the B<compressed> option is disabled
113 by default for binary curves and can be enabled by defining
114 the preprocessor macro B<OPENSSL_EC_BIN_PT_COMP> at compile time.
116 =item B<-param_enc> I<arg>
118 This specifies how the elliptic curve parameters are encoded.
119 Possible value are: B<named_curve>, i.e. the ec parameters are
120 specified by an OID, or B<explicit> where the ec parameters are
121 explicitly given (see RFC 3279 for the definition of the
122 EC parameters structures). The default value is B<named_curve>.
123 B<Note> the B<implicitlyCA> alternative, as specified in RFC 3279,
124 is currently not implemented in OpenSSL.
128 This option omits the public key components from the private key output.
132 This option checks the consistency of an EC private or public key.
134 =item B<-engine> I<id>
136 Specifying an engine (by its unique I<id> string) will cause this command
137 to attempt to obtain a functional reference to the specified engine,
138 thus initialising it if needed. The engine will then be set as the default
139 for all available algorithms.
145 To encrypt a private key using triple DES:
147 openssl ec -in key.pem -des3 -out keyout.pem
149 To convert a private key from PEM to DER format:
151 openssl ec -in key.pem -outform DER -out keyout.der
153 To print out the components of a private key to standard output:
155 openssl ec -in key.pem -text -noout
157 To just output the public part of a private key:
159 openssl ec -in key.pem -pubout -out pubkey.pem
161 To change the parameters encoding to B<explicit>:
163 openssl ec -in key.pem -param_enc explicit -out keyout.pem
165 To change the point conversion form to B<compressed>:
167 openssl ec -in key.pem -conv_form compressed -out keyout.pem
172 L<openssl-ecparam(1)>,
178 Copyright 2003-2019 The OpenSSL Project Authors. All Rights Reserved.
180 Licensed under the Apache License 2.0 (the "License"). You may not use
181 this file except in compliance with the License. You can obtain a copy
182 in the file LICENSE in the source distribution or at
183 L<https://www.openssl.org/source/license.html>.