1*b077aed3SPierre Pronchery=pod 2*b077aed3SPierre Pronchery 3*b077aed3SPierre Pronchery=begin comment 4*b077aed3SPierre Pronchery{- join("\n", @autowarntext) -} 5*b077aed3SPierre Pronchery 6*b077aed3SPierre Pronchery=end comment 7*b077aed3SPierre Pronchery 8*b077aed3SPierre Pronchery=head1 NAME 9*b077aed3SPierre Pronchery 10*b077aed3SPierre Proncheryopenssl-ec - EC key processing 11*b077aed3SPierre Pronchery 12*b077aed3SPierre Pronchery=head1 SYNOPSIS 13*b077aed3SPierre Pronchery 14*b077aed3SPierre ProncheryB<openssl> B<ec> 15*b077aed3SPierre Pronchery[B<-help>] 16*b077aed3SPierre Pronchery[B<-inform> B<DER>|B<PEM>|B<P12>|B<ENGINE>] 17*b077aed3SPierre Pronchery[B<-outform> B<DER>|B<PEM>] 18*b077aed3SPierre Pronchery[B<-in> I<filename>|I<uri>] 19*b077aed3SPierre Pronchery[B<-passin> I<arg>] 20*b077aed3SPierre Pronchery[B<-out> I<filename>] 21*b077aed3SPierre Pronchery[B<-passout> I<arg>] 22*b077aed3SPierre Pronchery[B<-des>] 23*b077aed3SPierre Pronchery[B<-des3>] 24*b077aed3SPierre Pronchery[B<-idea>] 25*b077aed3SPierre Pronchery[B<-text>] 26*b077aed3SPierre Pronchery[B<-noout>] 27*b077aed3SPierre Pronchery[B<-param_out>] 28*b077aed3SPierre Pronchery[B<-pubin>] 29*b077aed3SPierre Pronchery[B<-pubout>] 30*b077aed3SPierre Pronchery[B<-conv_form> I<arg>] 31*b077aed3SPierre Pronchery[B<-param_enc> I<arg>] 32*b077aed3SPierre Pronchery[B<-no_public>] 33*b077aed3SPierre Pronchery[B<-check>] 34*b077aed3SPierre Pronchery{- $OpenSSL::safe::opt_engine_synopsis -}{- $OpenSSL::safe::opt_provider_synopsis -} 35*b077aed3SPierre Pronchery 36*b077aed3SPierre Pronchery=head1 DESCRIPTION 37*b077aed3SPierre Pronchery 38*b077aed3SPierre ProncheryThe L<openssl-ec(1)> command processes EC keys. They can be converted between 39*b077aed3SPierre Proncheryvarious forms and their components printed out. B<Note> OpenSSL uses the 40*b077aed3SPierre Proncheryprivate key format specified in 'SEC 1: Elliptic Curve Cryptography' 41*b077aed3SPierre Pronchery(http://www.secg.org/). To convert an OpenSSL EC private key into the 42*b077aed3SPierre ProncheryPKCS#8 private key format use the L<openssl-pkcs8(1)> command. 43*b077aed3SPierre Pronchery 44*b077aed3SPierre Pronchery=head1 OPTIONS 45*b077aed3SPierre Pronchery 46*b077aed3SPierre Pronchery=over 4 47*b077aed3SPierre Pronchery 48*b077aed3SPierre Pronchery=item B<-help> 49*b077aed3SPierre Pronchery 50*b077aed3SPierre ProncheryPrint out a usage message. 51*b077aed3SPierre Pronchery 52*b077aed3SPierre Pronchery=item B<-inform> B<DER>|B<PEM>|B<P12>|B<ENGINE> 53*b077aed3SPierre Pronchery 54*b077aed3SPierre ProncheryThe key input format; unspecified by default. 55*b077aed3SPierre ProncherySee L<openssl-format-options(1)> for details. 56*b077aed3SPierre Pronchery 57*b077aed3SPierre Pronchery=item B<-outform> B<DER>|B<PEM> 58*b077aed3SPierre Pronchery 59*b077aed3SPierre ProncheryThe key output format; the default is B<PEM>. 60*b077aed3SPierre ProncherySee L<openssl-format-options(1)> for details. 61*b077aed3SPierre Pronchery 62*b077aed3SPierre ProncheryPrivate keys are an SEC1 private key or PKCS#8 format. 63*b077aed3SPierre ProncheryPublic keys are a B<SubjectPublicKeyInfo> as specified in IETF RFC 3280. 64*b077aed3SPierre Pronchery 65*b077aed3SPierre Pronchery=item B<-in> I<filename>|I<uri> 66*b077aed3SPierre Pronchery 67*b077aed3SPierre ProncheryThis specifies the input to read a key from or standard input if this 68*b077aed3SPierre Proncheryoption is not specified. If the key is encrypted a pass phrase will be 69*b077aed3SPierre Proncheryprompted for. 70*b077aed3SPierre Pronchery 71*b077aed3SPierre Pronchery=item B<-out> I<filename> 72*b077aed3SPierre Pronchery 73*b077aed3SPierre ProncheryThis specifies the output filename to write a key to or standard output by 74*b077aed3SPierre Proncheryis not specified. If any encryption options are set then a pass phrase will be 75*b077aed3SPierre Proncheryprompted for. The output filename should B<not> be the same as the input 76*b077aed3SPierre Proncheryfilename. 77*b077aed3SPierre Pronchery 78*b077aed3SPierre Pronchery=item B<-passin> I<arg>, B<-passout> I<arg> 79*b077aed3SPierre Pronchery 80*b077aed3SPierre ProncheryThe password source for the input and output file. 81*b077aed3SPierre ProncheryFor more information about the format of B<arg> 82*b077aed3SPierre Proncherysee L<openssl-passphrase-options(1)>. 83*b077aed3SPierre Pronchery 84*b077aed3SPierre Pronchery=item B<-des>|B<-des3>|B<-idea> 85*b077aed3SPierre Pronchery 86*b077aed3SPierre ProncheryThese options encrypt the private key with the DES, triple DES, IDEA or 87*b077aed3SPierre Proncheryany other cipher supported by OpenSSL before outputting it. A pass phrase is 88*b077aed3SPierre Proncheryprompted for. 89*b077aed3SPierre ProncheryIf none of these options is specified the key is written in plain text. This 90*b077aed3SPierre Proncherymeans that using this command to read in an encrypted key with no 91*b077aed3SPierre Proncheryencryption option can be used to remove the pass phrase from a key, or by 92*b077aed3SPierre Proncherysetting the encryption options it can be use to add or change the pass phrase. 93*b077aed3SPierre ProncheryThese options can only be used with PEM format output files. 94*b077aed3SPierre Pronchery 95*b077aed3SPierre Pronchery=item B<-text> 96*b077aed3SPierre Pronchery 97*b077aed3SPierre ProncheryPrints out the public, private key components and parameters. 98*b077aed3SPierre Pronchery 99*b077aed3SPierre Pronchery=item B<-noout> 100*b077aed3SPierre Pronchery 101*b077aed3SPierre ProncheryThis option prevents output of the encoded version of the key. 102*b077aed3SPierre Pronchery 103*b077aed3SPierre Pronchery=item B<-param_out> 104*b077aed3SPierre Pronchery 105*b077aed3SPierre ProncheryPrint the elliptic curve parameters. 106*b077aed3SPierre Pronchery 107*b077aed3SPierre Pronchery=item B<-pubin> 108*b077aed3SPierre Pronchery 109*b077aed3SPierre ProncheryBy default, a private key is read from the input file. With this option a 110*b077aed3SPierre Proncherypublic key is read instead. 111*b077aed3SPierre Pronchery 112*b077aed3SPierre Pronchery=item B<-pubout> 113*b077aed3SPierre Pronchery 114*b077aed3SPierre ProncheryBy default a private key is output. With this option a public 115*b077aed3SPierre Proncherykey will be output instead. This option is automatically set if the input is 116*b077aed3SPierre Proncherya public key. 117*b077aed3SPierre Pronchery 118*b077aed3SPierre Pronchery=item B<-conv_form> I<arg> 119*b077aed3SPierre Pronchery 120*b077aed3SPierre ProncheryThis specifies how the points on the elliptic curve are converted 121*b077aed3SPierre Proncheryinto octet strings. Possible values are: B<compressed>, B<uncompressed> (the 122*b077aed3SPierre Proncherydefault value) and B<hybrid>. For more information regarding 123*b077aed3SPierre Proncherythe point conversion forms please read the X9.62 standard. 124*b077aed3SPierre ProncheryB<Note> Due to patent issues the B<compressed> option is disabled 125*b077aed3SPierre Proncheryby default for binary curves and can be enabled by defining 126*b077aed3SPierre Proncherythe preprocessor macro B<OPENSSL_EC_BIN_PT_COMP> at compile time. 127*b077aed3SPierre Pronchery 128*b077aed3SPierre Pronchery=item B<-param_enc> I<arg> 129*b077aed3SPierre Pronchery 130*b077aed3SPierre ProncheryThis specifies how the elliptic curve parameters are encoded. 131*b077aed3SPierre ProncheryPossible value are: B<named_curve>, i.e. the ec parameters are 132*b077aed3SPierre Proncheryspecified by an OID, or B<explicit> where the ec parameters are 133*b077aed3SPierre Proncheryexplicitly given (see RFC 3279 for the definition of the 134*b077aed3SPierre ProncheryEC parameters structures). The default value is B<named_curve>. 135*b077aed3SPierre ProncheryB<Note> the B<implicitlyCA> alternative, as specified in RFC 3279, 136*b077aed3SPierre Proncheryis currently not implemented in OpenSSL. 137*b077aed3SPierre Pronchery 138*b077aed3SPierre Pronchery=item B<-no_public> 139*b077aed3SPierre Pronchery 140*b077aed3SPierre ProncheryThis option omits the public key components from the private key output. 141*b077aed3SPierre Pronchery 142*b077aed3SPierre Pronchery=item B<-check> 143*b077aed3SPierre Pronchery 144*b077aed3SPierre ProncheryThis option checks the consistency of an EC private or public key. 145*b077aed3SPierre Pronchery 146*b077aed3SPierre Pronchery{- $OpenSSL::safe::opt_engine_item -} 147*b077aed3SPierre Pronchery 148*b077aed3SPierre Pronchery{- $OpenSSL::safe::opt_provider_item -} 149*b077aed3SPierre Pronchery 150*b077aed3SPierre Pronchery=back 151*b077aed3SPierre Pronchery 152*b077aed3SPierre ProncheryThe L<openssl-pkey(1)> command is capable of performing all the operations 153*b077aed3SPierre Proncherythis command can, as well as supporting other public key types. 154*b077aed3SPierre Pronchery 155*b077aed3SPierre Pronchery=head1 EXAMPLES 156*b077aed3SPierre Pronchery 157*b077aed3SPierre ProncheryThe documentation for the L<openssl-pkey(1)> command contains examples 158*b077aed3SPierre Proncheryequivalent to the ones listed here. 159*b077aed3SPierre Pronchery 160*b077aed3SPierre ProncheryTo encrypt a private key using triple DES: 161*b077aed3SPierre Pronchery 162*b077aed3SPierre Pronchery openssl ec -in key.pem -des3 -out keyout.pem 163*b077aed3SPierre Pronchery 164*b077aed3SPierre ProncheryTo convert a private key from PEM to DER format: 165*b077aed3SPierre Pronchery 166*b077aed3SPierre Pronchery openssl ec -in key.pem -outform DER -out keyout.der 167*b077aed3SPierre Pronchery 168*b077aed3SPierre ProncheryTo print out the components of a private key to standard output: 169*b077aed3SPierre Pronchery 170*b077aed3SPierre Pronchery openssl ec -in key.pem -text -noout 171*b077aed3SPierre Pronchery 172*b077aed3SPierre ProncheryTo just output the public part of a private key: 173*b077aed3SPierre Pronchery 174*b077aed3SPierre Pronchery openssl ec -in key.pem -pubout -out pubkey.pem 175*b077aed3SPierre Pronchery 176*b077aed3SPierre ProncheryTo change the parameters encoding to B<explicit>: 177*b077aed3SPierre Pronchery 178*b077aed3SPierre Pronchery openssl ec -in key.pem -param_enc explicit -out keyout.pem 179*b077aed3SPierre Pronchery 180*b077aed3SPierre ProncheryTo change the point conversion form to B<compressed>: 181*b077aed3SPierre Pronchery 182*b077aed3SPierre Pronchery openssl ec -in key.pem -conv_form compressed -out keyout.pem 183*b077aed3SPierre Pronchery 184*b077aed3SPierre Pronchery=head1 SEE ALSO 185*b077aed3SPierre Pronchery 186*b077aed3SPierre ProncheryL<openssl(1)>, 187*b077aed3SPierre ProncheryL<openssl-pkey(1)>, 188*b077aed3SPierre ProncheryL<openssl-ecparam(1)>, 189*b077aed3SPierre ProncheryL<openssl-dsa(1)>, 190*b077aed3SPierre ProncheryL<openssl-rsa(1)> 191*b077aed3SPierre Pronchery 192*b077aed3SPierre Pronchery=head1 HISTORY 193*b077aed3SPierre Pronchery 194*b077aed3SPierre ProncheryThe B<-engine> option was deprecated in OpenSSL 3.0. 195*b077aed3SPierre Pronchery 196*b077aed3SPierre ProncheryThe B<-conv_form> and B<-no_public> options are no longer supported 197*b077aed3SPierre Proncherywith keys loaded from an engine in OpenSSL 3.0. 198*b077aed3SPierre Pronchery 199*b077aed3SPierre Pronchery=head1 COPYRIGHT 200*b077aed3SPierre Pronchery 201*b077aed3SPierre ProncheryCopyright 2003-2022 The OpenSSL Project Authors. All Rights Reserved. 202*b077aed3SPierre Pronchery 203*b077aed3SPierre ProncheryLicensed under the Apache License 2.0 (the "License"). You may not use 204*b077aed3SPierre Proncherythis file except in compliance with the License. You can obtain a copy 205*b077aed3SPierre Proncheryin the file LICENSE in the source distribution or at 206*b077aed3SPierre ProncheryL<https://www.openssl.org/source/license.html>. 207*b077aed3SPierre Pronchery 208*b077aed3SPierre Pronchery=cut 209