4 {- join("\n", @autowarntext) -}
10 openssl-ec - EC key processing
16 [B<-inform> B<DER>|B<PEM>|B<P12>|B<ENGINE>]
17 [B<-outform> B<DER>|B<PEM>]
30 [B<-conv_form> I<arg>]
31 [B<-param_enc> I<arg>]
34 {- $OpenSSL::safe::opt_engine_synopsis -}{- $OpenSSL::safe::opt_provider_synopsis -}
36 =for openssl ifdef engine
40 The L<openssl-ec(1)> command processes EC keys. They can be converted between
41 various forms and their components printed out. B<Note> OpenSSL uses the
42 private key format specified in 'SEC 1: Elliptic Curve Cryptography'
43 (http://www.secg.org/). To convert an OpenSSL EC private key into the
44 PKCS#8 private key format use the L<openssl-pkcs8(1)> command.
52 Print out a usage message.
54 =item B<-inform> B<DER>|B<PEM>|B<P12>|B<ENGINE>
56 The key input format; the default is B<PEM>.
57 The only value with effect is B<ENGINE>; all others have become obsolete.
58 See L<openssl(1)/Format Options> for details.
60 =item B<-outform> B<DER>|B<PEM>
62 The key output formats; the default is B<PEM>.
63 See L<openssl(1)/Format Options> for details.
65 Private keys are an SEC1 private key or PKCS#8 format.
66 Public keys are a B<SubjectPublicKeyInfo> as specified in IETF RFC 3280.
68 =item B<-in> I<filename>
70 This specifies the input filename to read a key from or standard input if this
71 option is not specified. If the key is encrypted a pass phrase will be
74 =item B<-out> I<filename>
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
81 =item B<-passin> I<arg>, B<-passout> I<arg>
83 The password source for the input and output file.
84 For more information about the format of B<arg>
85 see L<openssl(1)/Pass Phrase Options>.
87 =item B<-des>|B<-des3>|B<-idea>
89 These options encrypt the private key with the DES, triple DES, IDEA or
90 any other cipher supported by OpenSSL before outputting it. A pass phrase is
92 If none of these options is specified the key is written in plain text. This
93 means that using this command to read in an encrypted key with no
94 encryption option can be used to remove the pass phrase from a key, or by
95 setting the encryption options it can be use to add or change the pass phrase.
96 These options can only be used with PEM format output files.
100 Prints out the public, private key components and parameters.
104 This option prevents output of the encoded version of the key.
108 By default, a private key is read from the input file. With this option a
109 public key is read instead.
113 By default a private key is output. With this option a public
114 key will be output instead. This option is automatically set if the input is
117 =item B<-conv_form> I<arg>
119 This specifies how the points on the elliptic curve are converted
120 into octet strings. Possible values are: B<compressed> (the default
121 value), B<uncompressed> and B<hybrid>. For more information regarding
122 the point conversion forms please read the X9.62 standard.
123 B<Note> Due to patent issues the B<compressed> option is disabled
124 by default for binary curves and can be enabled by defining
125 the preprocessor macro B<OPENSSL_EC_BIN_PT_COMP> at compile time.
127 =item B<-param_enc> I<arg>
129 This specifies how the elliptic curve parameters are encoded.
130 Possible value are: B<named_curve>, i.e. the ec parameters are
131 specified by an OID, or B<explicit> where the ec parameters are
132 explicitly given (see RFC 3279 for the definition of the
133 EC parameters structures). The default value is B<named_curve>.
134 B<Note> the B<implicitlyCA> alternative, as specified in RFC 3279,
135 is currently not implemented in OpenSSL.
139 This option omits the public key components from the private key output.
143 This option checks the consistency of an EC private or public key.
145 {- $OpenSSL::safe::opt_engine_item -}
147 {- $OpenSSL::safe::opt_provider_item -}
153 Examples equivalent to these can be found in the documentation for the
154 non-deprecated L<openssl-pkey(1)> command.
156 To encrypt a private key using triple DES:
158 openssl ec -in key.pem -des3 -out keyout.pem
160 To convert a private key from PEM to DER format:
162 openssl ec -in key.pem -outform DER -out keyout.der
164 To print out the components of a private key to standard output:
166 openssl ec -in key.pem -text -noout
168 To just output the public part of a private key:
170 openssl ec -in key.pem -pubout -out pubkey.pem
172 To change the parameters encoding to B<explicit>:
174 openssl ec -in key.pem -param_enc explicit -out keyout.pem
176 To change the point conversion form to B<compressed>:
178 openssl ec -in key.pem -conv_form compressed -out keyout.pem
184 L<openssl-ecparam(1)>,
190 The B<-engine> option was deprecated in OpenSSL 3.0.
194 Copyright 2003-2020 The OpenSSL Project Authors. All Rights Reserved.
196 Licensed under the Apache License 2.0 (the "License"). You may not use
197 this file except in compliance with the License. You can obtain a copy
198 in the file LICENSE in the source distribution or at
199 L<https://www.openssl.org/source/license.html>.