Add some examples to the enc man page.
[openssl.git] / doc / man / rsa.pod
1
2 =pod
3
4 =head1 NAME
5
6 rsa - RSA key processing tool
7
8 =head1 SYNOPSIS
9
10 B<openssl> B<rsa>
11 [B<-inform PEM|NET|DER>]
12 [B<-outform PEM|NET|DER>]
13 [B<-in filename>]
14 [B<-passin password>]
15 [B<-envpassin var>]
16 [B<-out filename>]
17 [B<-passout password>]
18 [B<-envpassout var>]
19 [B<-des>]
20 [B<-des3>]
21 [B<-idea>]
22 [B<-text>]
23 [B<-noout>]
24 [B<-modulus>]
25 [B<-check>]
26 [B<-pubin>]
27 [B<-pubout>]
28
29 =head1 DESCRIPTION
30
31 The B<rsa> command processes RSA keys. They can be converted between various
32 forms and their components printed out. B<Note> this command uses the
33 traditional SSLeay compatible format for private key encryption: newer
34 applications should use the more secure PKCS#8 format using the B<pkcs8>
35 utility.
36
37 =head1 COMMAND OPTIONS
38
39 =over 4
40
41 =item B<-inform DER|NET|PEM>
42
43 This specifies the input format. The B<DER> option uses an ASN1 DER encoded
44 form compatible with the PKCS#1 RSAPrivateKey or RSAPublicKey format. The B<PEM>
45 form is the default format: it consists of the B<DER> format base64 encoded with
46 additional header and footer lines. The B<NET> form is a format compatible
47 with older Netscape servers and MS IIS, this uses unsalted RC4 for its
48 encryption It is not very secure and so should only be used when necessary.
49
50 =item B<-outform DER|NET|PEM>
51
52 This specifies the output format, the options have the same meaning as the 
53 B<-inform> option.
54
55 =item B<-in filename>
56
57 This specifies the input filename to read a key from or standard input if this
58 option is not specified. If the key is encrypted a pass phrase will be
59 prompted for.
60
61 =item B<-passin password>
62
63 the input file password. Since certain utilities like "ps" make the command line
64 visible this option should be used with caution.
65
66 =item B<-envpassin var>
67
68 read the input file password from the environment variable B<var>.
69
70 =item B<-out filename>
71
72 This specifies the output filename to write a key to or standard output by
73 is not specified. If any encryption options are set then a pass phrase will be
74 prompted for. The output filename should B<not> be the same as the input
75 filename.
76
77 =item B<-passout password>
78
79 the output file password. Since certain utilities like "ps" make the command line
80 visible this option should be used with caution.
81
82 =item B<-envpassout var>
83
84 read the output file password from the environment variable B<var>.
85
86 =item B<-des|-des3|-idea>
87
88 These options encrypt the private key with the DES, triple DES, or the 
89 IDEA ciphers respectively before outputting it. A pass phrase is prompted for.
90 If none of these options is specified the key is written in plain text. This
91 means that using the B<rsa> utility to read in an encrypted key with no
92 encryption option can be used to remove the pass phrase from a key, or by
93 setting the encryption options it can be use to add or change the pass phrase.
94 These options can only be used with PEM format output files.
95
96 =item B<-text>
97
98 prints out the various public or private key components in
99 plain text in addition to the encoded version. 
100
101 =item B<-noout>
102
103 this option prevents output of the encoded version of the key.
104
105 =item B<-modulus>
106
107 this option prints out the value of the modulus of the key.
108
109 =item B<-check>
110
111 this option checks the consistency of an RSA private key.
112
113 =item B<-pubin>
114
115 by default a private key is input file with this option a public key is input
116 instead.
117
118 =item B<-pubout>
119
120 by default a private key is output with this option a public
121 key will be output instead. This option is automatically set if the input is
122 a public key.
123
124 =back
125
126 =head1 NOTES
127
128 The PEM private key format uses the header and footer lines:
129
130  -----BEGIN RSA PRIVATE KEY-----
131  -----END RSA PRIVATE KEY-----
132
133 =head1 EXAMPLES
134
135 To remove the pass phrase on an RSA private key:
136
137 C<openssl rsa -in key.pem -out keyout.pem>
138
139 To encrypt a private key using triple DES:
140
141 C<openssl rsa -in key.pem -des3 -out keyout.pem>
142
143 To convert a private key from PEM to DER format: 
144
145 C<openssl rsa -in key.pem -outform DER -out keyout.der>
146
147 To print out the components of a private key to standard output:
148
149 C<openssl rsa -in key.pem -text -noout>
150
151 To just output the public part of a private key:
152
153 C<openssl rsa -in key.pem -pubout -out pubkey.pem>
154
155 =head1 CAVEATS
156
157 It should be possible to read or produce PKCS#8 format encrypted RSA keys:
158 at present it isn't.
159
160 =head1 SEE ALSO
161
162 pkcs8(1), dsa(1), genrsa(1), gendsa(1)
163
164 =cut