1160814Ssimon=pod 2160814Ssimon 3160814Ssimon=head1 NAME 4160814Ssimon 5160814Ssimonec - EC key processing 6160814Ssimon 7160814Ssimon=head1 SYNOPSIS 8160814Ssimon 9160814SsimonB<openssl> B<ec> 10160814Ssimon[B<-inform PEM|DER>] 11160814Ssimon[B<-outform PEM|DER>] 12160814Ssimon[B<-in filename>] 13160814Ssimon[B<-passin arg>] 14160814Ssimon[B<-out filename>] 15160814Ssimon[B<-passout arg>] 16160814Ssimon[B<-des>] 17160814Ssimon[B<-des3>] 18160814Ssimon[B<-idea>] 19160814Ssimon[B<-text>] 20160814Ssimon[B<-noout>] 21160814Ssimon[B<-param_out>] 22160814Ssimon[B<-pubin>] 23160814Ssimon[B<-pubout>] 24160814Ssimon[B<-conv_form arg>] 25160814Ssimon[B<-param_enc arg>] 26160814Ssimon[B<-engine id>] 27160814Ssimon 28160814Ssimon=head1 DESCRIPTION 29160814Ssimon 30160814SsimonThe B<ec> command processes EC keys. They can be converted between various 31160814Ssimonforms and their components printed out. B<Note> OpenSSL uses the 32160814Ssimonprivate key format specified in 'SEC 1: Elliptic Curve Cryptography' 33160814Ssimon(http://www.secg.org/). To convert a OpenSSL EC private key into the 34160814SsimonPKCS#8 private key format use the B<pkcs8> command. 35160814Ssimon 36160814Ssimon=head1 COMMAND OPTIONS 37160814Ssimon 38160814Ssimon=over 4 39160814Ssimon 40160814Ssimon=item B<-inform DER|PEM> 41160814Ssimon 42160814SsimonThis specifies the input format. The B<DER> option with a private key uses 43160814Ssimonan ASN.1 DER encoded SEC1 private key. When used with a public key it 44279264Sdelphijuses the SubjectPublicKeyInfo structure as specified in RFC 3280. 45160814SsimonThe B<PEM> form is the default format: it consists of the B<DER> format base64 46160814Ssimonencoded with additional header and footer lines. In the case of a private key 47160814SsimonPKCS#8 format is also accepted. 48160814Ssimon 49160814Ssimon=item B<-outform DER|PEM> 50160814Ssimon 51160814SsimonThis specifies the output format, the options have the same meaning as the 52160814SsimonB<-inform> option. 53160814Ssimon 54160814Ssimon=item B<-in filename> 55160814Ssimon 56160814SsimonThis specifies the input filename to read a key from or standard input if this 57160814Ssimonoption is not specified. If the key is encrypted a pass phrase will be 58160814Ssimonprompted for. 59160814Ssimon 60160814Ssimon=item B<-passin arg> 61160814Ssimon 62160814Ssimonthe input file password source. For more information about the format of B<arg> 63160814Ssimonsee the B<PASS PHRASE ARGUMENTS> section in L<openssl(1)|openssl(1)>. 64160814Ssimon 65160814Ssimon=item B<-out filename> 66160814Ssimon 67160814SsimonThis specifies the output filename to write a key to or standard output by 68160814Ssimonis not specified. If any encryption options are set then a pass phrase will be 69160814Ssimonprompted for. The output filename should B<not> be the same as the input 70160814Ssimonfilename. 71160814Ssimon 72160814Ssimon=item B<-passout arg> 73160814Ssimon 74160814Ssimonthe output file password source. For more information about the format of B<arg> 75160814Ssimonsee the B<PASS PHRASE ARGUMENTS> section in L<openssl(1)|openssl(1)>. 76160814Ssimon 77160814Ssimon=item B<-des|-des3|-idea> 78160814Ssimon 79160814SsimonThese options encrypt the private key with the DES, triple DES, IDEA or 80160814Ssimonany other cipher supported by OpenSSL before outputting it. A pass phrase is 81160814Ssimonprompted for. 82160814SsimonIf none of these options is specified the key is written in plain text. This 83160814Ssimonmeans that using the B<ec> utility to read in an encrypted key with no 84160814Ssimonencryption option can be used to remove the pass phrase from a key, or by 85160814Ssimonsetting the encryption options it can be use to add or change the pass phrase. 86160814SsimonThese options can only be used with PEM format output files. 87160814Ssimon 88160814Ssimon=item B<-text> 89160814Ssimon 90160814Ssimonprints out the public, private key components and parameters. 91160814Ssimon 92160814Ssimon=item B<-noout> 93160814Ssimon 94160814Ssimonthis option prevents output of the encoded version of the key. 95160814Ssimon 96160814Ssimon=item B<-modulus> 97160814Ssimon 98160814Ssimonthis option prints out the value of the public key component of the key. 99160814Ssimon 100160814Ssimon=item B<-pubin> 101160814Ssimon 102160814Ssimonby default a private key is read from the input file: with this option a 103160814Ssimonpublic key is read instead. 104160814Ssimon 105160814Ssimon=item B<-pubout> 106160814Ssimon 107160814Ssimonby default a private key is output. With this option a public 108160814Ssimonkey will be output instead. This option is automatically set if the input is 109160814Ssimona public key. 110160814Ssimon 111160814Ssimon=item B<-conv_form> 112160814Ssimon 113160814SsimonThis specifies how the points on the elliptic curve are converted 114160814Ssimoninto octet strings. Possible values are: B<compressed> (the default 115160814Ssimonvalue), B<uncompressed> and B<hybrid>. For more information regarding 116160814Ssimonthe point conversion forms please read the X9.62 standard. 117160814SsimonB<Note> Due to patent issues the B<compressed> option is disabled 118160814Ssimonby default for binary curves and can be enabled by defining 119160814Ssimonthe preprocessor macro B<OPENSSL_EC_BIN_PT_COMP> at compile time. 120160814Ssimon 121160814Ssimon=item B<-param_enc arg> 122160814Ssimon 123160814SsimonThis specifies how the elliptic curve parameters are encoded. 124160814SsimonPossible value are: B<named_curve>, i.e. the ec parameters are 125160814Ssimonspecified by a OID, or B<explicit> where the ec parameters are 126160814Ssimonexplicitly given (see RFC 3279 for the definition of the 127160814SsimonEC parameters structures). The default value is B<named_curve>. 128160814SsimonB<Note> the B<implicitlyCA> alternative ,as specified in RFC 3279, 129160814Ssimonis currently not implemented in OpenSSL. 130160814Ssimon 131160814Ssimon=item B<-engine id> 132160814Ssimon 133238405Sjkimspecifying an engine (by its unique B<id> string) will cause B<ec> 134160814Ssimonto attempt to obtain a functional reference to the specified engine, 135160814Ssimonthus initialising it if needed. The engine will then be set as the default 136160814Ssimonfor all available algorithms. 137160814Ssimon 138160814Ssimon=back 139160814Ssimon 140160814Ssimon=head1 NOTES 141160814Ssimon 142160814SsimonThe PEM private key format uses the header and footer lines: 143160814Ssimon 144160814Ssimon -----BEGIN EC PRIVATE KEY----- 145160814Ssimon -----END EC PRIVATE KEY----- 146160814Ssimon 147160814SsimonThe PEM public key format uses the header and footer lines: 148160814Ssimon 149160814Ssimon -----BEGIN PUBLIC KEY----- 150160814Ssimon -----END PUBLIC KEY----- 151160814Ssimon 152160814Ssimon=head1 EXAMPLES 153160814Ssimon 154160814SsimonTo encrypt a private key using triple DES: 155160814Ssimon 156160814Ssimon openssl ec -in key.pem -des3 -out keyout.pem 157160814Ssimon 158160814SsimonTo convert a private key from PEM to DER format: 159160814Ssimon 160160814Ssimon openssl ec -in key.pem -outform DER -out keyout.der 161160814Ssimon 162160814SsimonTo print out the components of a private key to standard output: 163160814Ssimon 164160814Ssimon openssl ec -in key.pem -text -noout 165160814Ssimon 166160814SsimonTo just output the public part of a private key: 167160814Ssimon 168160814Ssimon openssl ec -in key.pem -pubout -out pubkey.pem 169160814Ssimon 170160814SsimonTo change the parameters encoding to B<explicit>: 171160814Ssimon 172160814Ssimon openssl ec -in key.pem -param_enc explicit -out keyout.pem 173160814Ssimon 174160814SsimonTo change the point conversion form to B<compressed>: 175160814Ssimon 176160814Ssimon openssl ec -in key.pem -conv_form compressed -out keyout.pem 177160814Ssimon 178160814Ssimon=head1 SEE ALSO 179160814Ssimon 180160814SsimonL<ecparam(1)|ecparam(1)>, L<dsa(1)|dsa(1)>, L<rsa(1)|rsa(1)> 181160814Ssimon 182160814Ssimon=head1 HISTORY 183160814Ssimon 184160814SsimonThe ec command was first introduced in OpenSSL 0.9.8. 185160814Ssimon 186160814Ssimon=head1 AUTHOR 187160814Ssimon 188160814SsimonNils Larsch for the OpenSSL project (http://www.openssl.org). 189160814Ssimon 190160814Ssimon=cut 191