1251607Sdim=pod 2251607Sdim 3251607Sdim=head1 NAME 4251607Sdim 5251607Sdimec - EC key processing 6251607Sdim 7251607Sdim=head1 SYNOPSIS 8251607Sdim 9251607SdimB<openssl> B<ec> 10251607Sdim[B<-inform PEM|DER>] 11251607Sdim[B<-outform PEM|DER>] 12251607Sdim[B<-in filename>] 13251607Sdim[B<-passin arg>] 14251607Sdim[B<-out filename>] 15251607Sdim[B<-passout arg>] 16251607Sdim[B<-des>] 17251607Sdim[B<-des3>] 18251607Sdim[B<-idea>] 19251607Sdim[B<-text>] 20251607Sdim[B<-noout>] 21251607Sdim[B<-param_out>] 22251607Sdim[B<-pubin>] 23251607Sdim[B<-pubout>] 24251607Sdim[B<-conv_form arg>] 25251607Sdim[B<-param_enc arg>] 26251607Sdim[B<-engine id>] 27251607Sdim 28251607Sdim=head1 DESCRIPTION 29251607Sdim 30251607SdimThe B<ec> command processes EC keys. They can be converted between various 31263508Sdimforms and their components printed out. B<Note> OpenSSL uses the 32263508Sdimprivate key format specified in 'SEC 1: Elliptic Curve Cryptography' 33263508Sdim(http://www.secg.org/). To convert a OpenSSL EC private key into the 34263508SdimPKCS#8 private key format use the B<pkcs8> command. 35263508Sdim 36263508Sdim=head1 COMMAND OPTIONS 37263508Sdim 38263508Sdim=over 4 39263508Sdim 40263508Sdim=item B<-inform DER|PEM> 41263508Sdim 42263508SdimThis specifies the input format. The B<DER> option with a private key uses 43263508Sdiman ASN.1 DER encoded SEC1 private key. When used with a public key it 44263508Sdimuses the SubjectPublicKeyInfo structure as specified in RFC 3280. 45251607SdimThe B<PEM> form is the default format: it consists of the B<DER> format base64 46263508Sdimencoded with additional header and footer lines. In the case of a private key 47263508SdimPKCS#8 format is also accepted. 48263508Sdim 49263508Sdim=item B<-outform DER|PEM> 50263508Sdim 51263508SdimThis specifies the output format, the options have the same meaning as the 52263508SdimB<-inform> option. 53263508Sdim 54263508Sdim=item B<-in filename> 55263508Sdim 56251607SdimThis specifies the input filename to read a key from or standard input if this 57251607Sdimoption is not specified. If the key is encrypted a pass phrase will be 58251607Sdimprompted for. 59251607Sdim 60251607Sdim=item B<-passin arg> 61251607Sdim 62251607Sdimthe input file password source. For more information about the format of B<arg> 63251607Sdimsee the B<PASS PHRASE ARGUMENTS> section in L<openssl(1)|openssl(1)>. 64263508Sdim 65263508Sdim=item B<-out filename> 66263508Sdim 67263508SdimThis specifies the output filename to write a key to or standard output by 68263508Sdimis not specified. If any encryption options are set then a pass phrase will be 69263508Sdimprompted for. The output filename should B<not> be the same as the input 70263508Sdimfilename. 71263508Sdim 72263508Sdim=item B<-passout arg> 73263508Sdim 74263508Sdimthe output file password source. For more information about the format of B<arg> 75263508Sdimsee the B<PASS PHRASE ARGUMENTS> section in L<openssl(1)|openssl(1)>. 76263508Sdim 77263508Sdim=item B<-des|-des3|-idea> 78263508Sdim 79263508SdimThese options encrypt the private key with the DES, triple DES, IDEA or 80263508Sdimany other cipher supported by OpenSSL before outputting it. A pass phrase is 81263508Sdimprompted for. 82263508SdimIf none of these options is specified the key is written in plain text. This 83263508Sdimmeans that using the B<ec> utility to read in an encrypted key with no 84263508Sdimencryption option can be used to remove the pass phrase from a key, or by 85263508Sdimsetting the encryption options it can be use to add or change the pass phrase. 86263508SdimThese options can only be used with PEM format output files. 87263508Sdim 88263508Sdim=item B<-text> 89263508Sdim 90263508Sdimprints out the public, private key components and parameters. 91263508Sdim 92263508Sdim=item B<-noout> 93263508Sdim 94263508Sdimthis option prevents output of the encoded version of the key. 95263508Sdim 96263508Sdim=item B<-modulus> 97263508Sdim 98263508Sdimthis option prints out the value of the public key component of the key. 99263508Sdim 100263508Sdim=item B<-pubin> 101263508Sdim 102263508Sdimby default a private key is read from the input file: with this option a 103263508Sdimpublic key is read instead. 104263508Sdim 105263508Sdim=item B<-pubout> 106263508Sdim 107263508Sdimby default a private key is output. With this option a public 108263508Sdimkey will be output instead. This option is automatically set if the input is 109263508Sdima public key. 110263508Sdim 111251607Sdim=item B<-conv_form> 112251607Sdim 113251607SdimThis specifies how the points on the elliptic curve are converted 114251607Sdiminto octet strings. Possible values are: B<compressed> (the default 115263508Sdimvalue), B<uncompressed> and B<hybrid>. For more information regarding 116251607Sdimthe point conversion forms please read the X9.62 standard. 117251607SdimB<Note> Due to patent issues the B<compressed> option is disabled 118251607Sdimby default for binary curves and can be enabled by defining 119263508Sdimthe preprocessor macro B<OPENSSL_EC_BIN_PT_COMP> at compile time. 120263508Sdim 121263508Sdim=item B<-param_enc arg> 122263508Sdim 123263508SdimThis specifies how the elliptic curve parameters are encoded. 124263508SdimPossible value are: B<named_curve>, i.e. the ec parameters are 125263508Sdimspecified by a OID, or B<explicit> where the ec parameters are 126263508Sdimexplicitly given (see RFC 3279 for the definition of the 127263508SdimEC parameters structures). The default value is B<named_curve>. 128263508SdimB<Note> the B<implicitlyCA> alternative ,as specified in RFC 3279, 129263508Sdimis currently not implemented in OpenSSL. 130263508Sdim 131263508Sdim=item B<-engine id> 132251607Sdim 133251607Sdimspecifying an engine (by its unique B<id> string) will cause B<ec> 134251607Sdimto attempt to obtain a functional reference to the specified engine, 135251607Sdimthus initialising it if needed. The engine will then be set as the default 136251607Sdimfor all available algorithms. 137251607Sdim 138251607Sdim=back 139251607Sdim 140263508Sdim=head1 NOTES 141263508Sdim 142251607SdimThe PEM private key format uses the header and footer lines: 143251607Sdim 144251607Sdim -----BEGIN EC PRIVATE KEY----- 145251607Sdim -----END EC PRIVATE KEY----- 146251607Sdim 147251607SdimThe PEM public key format uses the header and footer lines: 148251607Sdim 149251607Sdim -----BEGIN PUBLIC KEY----- 150251607Sdim -----END PUBLIC KEY----- 151251607Sdim 152263508Sdim=head1 EXAMPLES 153263508Sdim 154263508SdimTo encrypt a private key using triple DES: 155263508Sdim 156263508Sdim openssl ec -in key.pem -des3 -out keyout.pem 157263508Sdim 158263508SdimTo convert a private key from PEM to DER format: 159263508Sdim 160263508Sdim openssl ec -in key.pem -outform DER -out keyout.der 161263508Sdim 162263508SdimTo print out the components of a private key to standard output: 163263508Sdim 164263508Sdim openssl ec -in key.pem -text -noout 165263508Sdim 166263508SdimTo just output the public part of a private key: 167263508Sdim 168263508Sdim openssl ec -in key.pem -pubout -out pubkey.pem 169263508Sdim 170263508SdimTo change the parameters encoding to B<explicit>: 171263508Sdim 172263508Sdim openssl ec -in key.pem -param_enc explicit -out keyout.pem 173263508Sdim 174263508SdimTo change the point conversion form to B<compressed>: 175251607Sdim 176251607Sdim openssl ec -in key.pem -conv_form compressed -out keyout.pem 177251607Sdim 178251607Sdim=head1 SEE ALSO 179251607Sdim 180251607SdimL<ecparam(1)|ecparam(1)>, L<dsa(1)|dsa(1)>, L<rsa(1)|rsa(1)> 181251607Sdim 182251607Sdim=head1 HISTORY 183251607Sdim 184251607SdimThe ec command was first introduced in OpenSSL 0.9.8. 185251607Sdim 186251607Sdim=head1 AUTHOR 187251607Sdim 188251607SdimNils Larsch for the OpenSSL project (http://www.openssl.org). 189251607Sdim 190251607Sdim=cut 191263508Sdim