1ebfedea0SLionel Sambuc=pod 2ebfedea0SLionel Sambuc 3ebfedea0SLionel Sambuc=head1 NAME 4ebfedea0SLionel Sambuc 5ebfedea0SLionel Sambucec - EC key processing 6ebfedea0SLionel Sambuc 7ebfedea0SLionel Sambuc=head1 SYNOPSIS 8ebfedea0SLionel Sambuc 9ebfedea0SLionel SambucB<openssl> B<ec> 10ebfedea0SLionel Sambuc[B<-inform PEM|DER>] 11ebfedea0SLionel Sambuc[B<-outform PEM|DER>] 12ebfedea0SLionel Sambuc[B<-in filename>] 13ebfedea0SLionel Sambuc[B<-passin arg>] 14ebfedea0SLionel Sambuc[B<-out filename>] 15ebfedea0SLionel Sambuc[B<-passout arg>] 16ebfedea0SLionel Sambuc[B<-des>] 17ebfedea0SLionel Sambuc[B<-des3>] 18ebfedea0SLionel Sambuc[B<-idea>] 19ebfedea0SLionel Sambuc[B<-text>] 20ebfedea0SLionel Sambuc[B<-noout>] 21ebfedea0SLionel Sambuc[B<-param_out>] 22ebfedea0SLionel Sambuc[B<-pubin>] 23ebfedea0SLionel Sambuc[B<-pubout>] 24ebfedea0SLionel Sambuc[B<-conv_form arg>] 25ebfedea0SLionel Sambuc[B<-param_enc arg>] 26ebfedea0SLionel Sambuc[B<-engine id>] 27ebfedea0SLionel Sambuc 28ebfedea0SLionel Sambuc=head1 DESCRIPTION 29ebfedea0SLionel Sambuc 30ebfedea0SLionel SambucThe B<ec> command processes EC keys. They can be converted between various 31ebfedea0SLionel Sambucforms and their components printed out. B<Note> OpenSSL uses the 32ebfedea0SLionel Sambucprivate key format specified in 'SEC 1: Elliptic Curve Cryptography' 33ebfedea0SLionel Sambuc(http://www.secg.org/). To convert a OpenSSL EC private key into the 34ebfedea0SLionel SambucPKCS#8 private key format use the B<pkcs8> command. 35ebfedea0SLionel Sambuc 36ebfedea0SLionel Sambuc=head1 COMMAND OPTIONS 37ebfedea0SLionel Sambuc 38ebfedea0SLionel Sambuc=over 4 39ebfedea0SLionel Sambuc 40ebfedea0SLionel Sambuc=item B<-inform DER|PEM> 41ebfedea0SLionel Sambuc 42ebfedea0SLionel SambucThis specifies the input format. The B<DER> option with a private key uses 43ebfedea0SLionel Sambucan ASN.1 DER encoded SEC1 private key. When used with a public key it 44*0a6a1f1dSLionel Sambucuses the SubjectPublicKeyInfo structure as specified in RFC 3280. 45ebfedea0SLionel SambucThe B<PEM> form is the default format: it consists of the B<DER> format base64 46ebfedea0SLionel Sambucencoded with additional header and footer lines. In the case of a private key 47ebfedea0SLionel SambucPKCS#8 format is also accepted. 48ebfedea0SLionel Sambuc 49ebfedea0SLionel Sambuc=item B<-outform DER|PEM> 50ebfedea0SLionel Sambuc 51ebfedea0SLionel SambucThis specifies the output format, the options have the same meaning as the 52ebfedea0SLionel SambucB<-inform> option. 53ebfedea0SLionel Sambuc 54ebfedea0SLionel Sambuc=item B<-in filename> 55ebfedea0SLionel Sambuc 56ebfedea0SLionel SambucThis specifies the input filename to read a key from or standard input if this 57ebfedea0SLionel Sambucoption is not specified. If the key is encrypted a pass phrase will be 58ebfedea0SLionel Sambucprompted for. 59ebfedea0SLionel Sambuc 60ebfedea0SLionel Sambuc=item B<-passin arg> 61ebfedea0SLionel Sambuc 62ebfedea0SLionel Sambucthe input file password source. For more information about the format of B<arg> 63ebfedea0SLionel Sambucsee the B<PASS PHRASE ARGUMENTS> section in L<openssl(1)|openssl(1)>. 64ebfedea0SLionel Sambuc 65ebfedea0SLionel Sambuc=item B<-out filename> 66ebfedea0SLionel Sambuc 67ebfedea0SLionel SambucThis specifies the output filename to write a key to or standard output by 68ebfedea0SLionel Sambucis not specified. If any encryption options are set then a pass phrase will be 69ebfedea0SLionel Sambucprompted for. The output filename should B<not> be the same as the input 70ebfedea0SLionel Sambucfilename. 71ebfedea0SLionel Sambuc 72ebfedea0SLionel Sambuc=item B<-passout arg> 73ebfedea0SLionel Sambuc 74ebfedea0SLionel Sambucthe output file password source. For more information about the format of B<arg> 75ebfedea0SLionel Sambucsee the B<PASS PHRASE ARGUMENTS> section in L<openssl(1)|openssl(1)>. 76ebfedea0SLionel Sambuc 77ebfedea0SLionel Sambuc=item B<-des|-des3|-idea> 78ebfedea0SLionel Sambuc 79ebfedea0SLionel SambucThese options encrypt the private key with the DES, triple DES, IDEA or 80ebfedea0SLionel Sambucany other cipher supported by OpenSSL before outputting it. A pass phrase is 81ebfedea0SLionel Sambucprompted for. 82ebfedea0SLionel SambucIf none of these options is specified the key is written in plain text. This 83ebfedea0SLionel Sambucmeans that using the B<ec> utility to read in an encrypted key with no 84ebfedea0SLionel Sambucencryption option can be used to remove the pass phrase from a key, or by 85ebfedea0SLionel Sambucsetting the encryption options it can be use to add or change the pass phrase. 86ebfedea0SLionel SambucThese options can only be used with PEM format output files. 87ebfedea0SLionel Sambuc 88ebfedea0SLionel Sambuc=item B<-text> 89ebfedea0SLionel Sambuc 90ebfedea0SLionel Sambucprints out the public, private key components and parameters. 91ebfedea0SLionel Sambuc 92ebfedea0SLionel Sambuc=item B<-noout> 93ebfedea0SLionel Sambuc 94ebfedea0SLionel Sambucthis option prevents output of the encoded version of the key. 95ebfedea0SLionel Sambuc 96ebfedea0SLionel Sambuc=item B<-modulus> 97ebfedea0SLionel Sambuc 98ebfedea0SLionel Sambucthis option prints out the value of the public key component of the key. 99ebfedea0SLionel Sambuc 100ebfedea0SLionel Sambuc=item B<-pubin> 101ebfedea0SLionel Sambuc 102ebfedea0SLionel Sambucby default a private key is read from the input file: with this option a 103ebfedea0SLionel Sambucpublic key is read instead. 104ebfedea0SLionel Sambuc 105ebfedea0SLionel Sambuc=item B<-pubout> 106ebfedea0SLionel Sambuc 107ebfedea0SLionel Sambucby default a private key is output. With this option a public 108ebfedea0SLionel Sambuckey will be output instead. This option is automatically set if the input is 109ebfedea0SLionel Sambuca public key. 110ebfedea0SLionel Sambuc 111ebfedea0SLionel Sambuc=item B<-conv_form> 112ebfedea0SLionel Sambuc 113ebfedea0SLionel SambucThis specifies how the points on the elliptic curve are converted 114ebfedea0SLionel Sambucinto octet strings. Possible values are: B<compressed> (the default 115ebfedea0SLionel Sambucvalue), B<uncompressed> and B<hybrid>. For more information regarding 116ebfedea0SLionel Sambucthe point conversion forms please read the X9.62 standard. 117ebfedea0SLionel SambucB<Note> Due to patent issues the B<compressed> option is disabled 118ebfedea0SLionel Sambucby default for binary curves and can be enabled by defining 119ebfedea0SLionel Sambucthe preprocessor macro B<OPENSSL_EC_BIN_PT_COMP> at compile time. 120ebfedea0SLionel Sambuc 121ebfedea0SLionel Sambuc=item B<-param_enc arg> 122ebfedea0SLionel Sambuc 123ebfedea0SLionel SambucThis specifies how the elliptic curve parameters are encoded. 124ebfedea0SLionel SambucPossible value are: B<named_curve>, i.e. the ec parameters are 125ebfedea0SLionel Sambucspecified by a OID, or B<explicit> where the ec parameters are 126ebfedea0SLionel Sambucexplicitly given (see RFC 3279 for the definition of the 127ebfedea0SLionel SambucEC parameters structures). The default value is B<named_curve>. 128ebfedea0SLionel SambucB<Note> the B<implicitlyCA> alternative ,as specified in RFC 3279, 129ebfedea0SLionel Sambucis currently not implemented in OpenSSL. 130ebfedea0SLionel Sambuc 131ebfedea0SLionel Sambuc=item B<-engine id> 132ebfedea0SLionel Sambuc 133ebfedea0SLionel Sambucspecifying an engine (by its unique B<id> string) will cause B<ec> 134ebfedea0SLionel Sambucto attempt to obtain a functional reference to the specified engine, 135ebfedea0SLionel Sambucthus initialising it if needed. The engine will then be set as the default 136ebfedea0SLionel Sambucfor all available algorithms. 137ebfedea0SLionel Sambuc 138ebfedea0SLionel Sambuc=back 139ebfedea0SLionel Sambuc 140ebfedea0SLionel Sambuc=head1 NOTES 141ebfedea0SLionel Sambuc 142ebfedea0SLionel SambucThe PEM private key format uses the header and footer lines: 143ebfedea0SLionel Sambuc 144ebfedea0SLionel Sambuc -----BEGIN EC PRIVATE KEY----- 145ebfedea0SLionel Sambuc -----END EC PRIVATE KEY----- 146ebfedea0SLionel Sambuc 147ebfedea0SLionel SambucThe PEM public key format uses the header and footer lines: 148ebfedea0SLionel Sambuc 149ebfedea0SLionel Sambuc -----BEGIN PUBLIC KEY----- 150ebfedea0SLionel Sambuc -----END PUBLIC KEY----- 151ebfedea0SLionel Sambuc 152ebfedea0SLionel Sambuc=head1 EXAMPLES 153ebfedea0SLionel Sambuc 154ebfedea0SLionel SambucTo encrypt a private key using triple DES: 155ebfedea0SLionel Sambuc 156ebfedea0SLionel Sambuc openssl ec -in key.pem -des3 -out keyout.pem 157ebfedea0SLionel Sambuc 158ebfedea0SLionel SambucTo convert a private key from PEM to DER format: 159ebfedea0SLionel Sambuc 160ebfedea0SLionel Sambuc openssl ec -in key.pem -outform DER -out keyout.der 161ebfedea0SLionel Sambuc 162ebfedea0SLionel SambucTo print out the components of a private key to standard output: 163ebfedea0SLionel Sambuc 164ebfedea0SLionel Sambuc openssl ec -in key.pem -text -noout 165ebfedea0SLionel Sambuc 166ebfedea0SLionel SambucTo just output the public part of a private key: 167ebfedea0SLionel Sambuc 168ebfedea0SLionel Sambuc openssl ec -in key.pem -pubout -out pubkey.pem 169ebfedea0SLionel Sambuc 170ebfedea0SLionel SambucTo change the parameters encoding to B<explicit>: 171ebfedea0SLionel Sambuc 172ebfedea0SLionel Sambuc openssl ec -in key.pem -param_enc explicit -out keyout.pem 173ebfedea0SLionel Sambuc 174ebfedea0SLionel SambucTo change the point conversion form to B<compressed>: 175ebfedea0SLionel Sambuc 176ebfedea0SLionel Sambuc openssl ec -in key.pem -conv_form compressed -out keyout.pem 177ebfedea0SLionel Sambuc 178ebfedea0SLionel Sambuc=head1 SEE ALSO 179ebfedea0SLionel Sambuc 180ebfedea0SLionel SambucL<ecparam(1)|ecparam(1)>, L<dsa(1)|dsa(1)>, L<rsa(1)|rsa(1)> 181ebfedea0SLionel Sambuc 182ebfedea0SLionel Sambuc=head1 HISTORY 183ebfedea0SLionel Sambuc 184ebfedea0SLionel SambucThe ec command was first introduced in OpenSSL 0.9.8. 185ebfedea0SLionel Sambuc 186ebfedea0SLionel Sambuc=head1 AUTHOR 187ebfedea0SLionel Sambuc 188ebfedea0SLionel SambucNils Larsch for the OpenSSL project (http://www.openssl.org). 189ebfedea0SLionel Sambuc 190ebfedea0SLionel Sambuc=cut 191