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