6 rsa - RSA key processing tool
11 [B<-inform PEM|NET|DER>]
12 [B<-outform PEM|NET|DER>]
17 [B<-passout password>]
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>
37 =head1 COMMAND OPTIONS
41 =item B<-inform DER|NET|PEM>
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.
50 =item B<-outform DER|NET|PEM>
52 This specifies the output format, the options have the same meaning as the
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
61 =item B<-passin password>
63 the input file password. Since certain utilities like "ps" make the command line
64 visible this option should be used with caution.
66 =item B<-envpassin var>
68 read the input file password from the environment variable B<var>.
70 =item B<-out filename>
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
77 =item B<-passout password>
79 the output file password. Since certain utilities like "ps" make the command line
80 visible this option should be used with caution.
82 =item B<-envpassout var>
84 read the output file password from the environment variable B<var>.
86 =item B<-des|-des3|-idea>
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.
98 prints out the various public or private key components in
99 plain text in addition to the encoded version.
103 this option prevents output of the encoded version of the key.
107 this option prints out the value of the modulus of the key.
111 this option checks the consistency of an RSA private key.
115 by default a private key is input file with this option a public key is input
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
128 The PEM private key format uses the header and footer lines:
130 -----BEGIN RSA PRIVATE KEY-----
131 -----END RSA PRIVATE KEY-----
135 To remove the pass phrase on an RSA private key:
137 C<openssl rsa -in key.pem -out keyout.pem>
139 To encrypt a private key using triple DES:
141 C<openssl rsa -in key.pem -des3 -out keyout.pem>
143 To convert a private key from PEM to DER format:
145 C<openssl rsa -in key.pem -outform DER -out keyout.der>
147 To print out the components of a private key to standard output:
149 C<openssl rsa -in key.pem -text -noout>
151 To just output the public part of a private key:
153 C<openssl rsa -in key.pem -pubout -out pubkey.pem>
157 It should be possible to read or produce PKCS#8 format encrypted RSA keys:
162 pkcs8(1), dsa(1), genrsa(1), gendsa(1)