rsa.pod revision 325337
1 2=pod 3 4=head1 NAME 5 6openssl-rsa, 7rsa - RSA key processing tool 8 9=head1 SYNOPSIS 10 11B<openssl> B<rsa> 12[B<-inform PEM|NET|DER>] 13[B<-outform PEM|NET|DER>] 14[B<-in filename>] 15[B<-passin arg>] 16[B<-out filename>] 17[B<-passout arg>] 18[B<-sgckey>] 19[B<-aes128>] 20[B<-aes192>] 21[B<-aes256>] 22[B<-camellia128>] 23[B<-camellia192>] 24[B<-camellia256>] 25[B<-des>] 26[B<-des3>] 27[B<-idea>] 28[B<-text>] 29[B<-noout>] 30[B<-modulus>] 31[B<-check>] 32[B<-pubin>] 33[B<-pubout>] 34[B<-RSAPublicKey_in>] 35[B<-RSAPublicKey_out>] 36[B<-engine id>] 37 38=head1 DESCRIPTION 39 40The B<rsa> command processes RSA keys. They can be converted between various 41forms and their components printed out. B<Note> this command uses the 42traditional SSLeay compatible format for private key encryption: newer 43applications should use the more secure PKCS#8 format using the B<pkcs8> 44utility. 45 46=head1 COMMAND OPTIONS 47 48=over 4 49 50=item B<-inform DER|NET|PEM> 51 52This specifies the input format. The B<DER> option uses an ASN1 DER encoded 53form compatible with the PKCS#1 RSAPrivateKey or SubjectPublicKeyInfo format. 54The B<PEM> form is the default format: it consists of the B<DER> format base64 55encoded with additional header and footer lines. On input PKCS#8 format private 56keys are also accepted. The B<NET> form is a format is described in the B<NOTES> 57section. 58 59=item B<-outform DER|NET|PEM> 60 61This specifies the output format, the options have the same meaning as the 62B<-inform> option. 63 64=item B<-in filename> 65 66This specifies the input filename to read a key from or standard input if this 67option is not specified. If the key is encrypted a pass phrase will be 68prompted for. 69 70=item B<-passin arg> 71 72the input file password source. For more information about the format of B<arg> 73see the B<PASS PHRASE ARGUMENTS> section in L<openssl(1)|openssl(1)>. 74 75=item B<-out filename> 76 77This specifies the output filename to write a key to or standard output if this 78option is not specified. If any encryption options are set then a pass phrase 79will be prompted for. The output filename should B<not> be the same as the input 80filename. 81 82=item B<-passout password> 83 84the output file password source. For more information about the format of B<arg> 85see the B<PASS PHRASE ARGUMENTS> section in L<openssl(1)|openssl(1)>. 86 87=item B<-sgckey> 88 89use the modified NET algorithm used with some versions of Microsoft IIS and SGC 90keys. 91 92=item B<-aes128|-aes192|-aes256|-camellia128|-camellia192|-camellia256|-des|-des3|-idea> 93 94These options encrypt the private key with the specified 95cipher before outputting it. A pass phrase is prompted for. 96If none of these options is specified the key is written in plain text. This 97means that using the B<rsa> utility to read in an encrypted key with no 98encryption option can be used to remove the pass phrase from a key, or by 99setting the encryption options it can be use to add or change the pass phrase. 100These options can only be used with PEM format output files. 101 102=item B<-text> 103 104prints out the various public or private key components in 105plain text in addition to the encoded version. 106 107=item B<-noout> 108 109this option prevents output of the encoded version of the key. 110 111=item B<-modulus> 112 113this option prints out the value of the modulus of the key. 114 115=item B<-check> 116 117this option checks the consistency of an RSA private key. 118 119=item B<-pubin> 120 121by default a private key is read from the input file: with this 122option a public key is read instead. 123 124=item B<-pubout> 125 126by default a private key is output: with this option a public 127key will be output instead. This option is automatically set if 128the input is a public key. 129 130=item B<-RSAPublicKey_in>, B<-RSAPublicKey_out> 131 132like B<-pubin> and B<-pubout> except B<RSAPublicKey> format is used instead. 133 134=item B<-engine id> 135 136specifying an engine (by its unique B<id> string) will cause B<rsa> 137to attempt to obtain a functional reference to the specified engine, 138thus initialising it if needed. The engine will then be set as the default 139for all available algorithms. 140 141=back 142 143=head1 NOTES 144 145The PEM private key format uses the header and footer lines: 146 147 -----BEGIN RSA PRIVATE KEY----- 148 -----END RSA PRIVATE KEY----- 149 150The PEM public key format uses the header and footer lines: 151 152 -----BEGIN PUBLIC KEY----- 153 -----END PUBLIC KEY----- 154 155The PEM B<RSAPublicKey> format uses the header and footer lines: 156 157 -----BEGIN RSA PUBLIC KEY----- 158 -----END RSA PUBLIC KEY----- 159 160The B<NET> form is a format compatible with older Netscape servers 161and Microsoft IIS .key files, this uses unsalted RC4 for its encryption. 162It is not very secure and so should only be used when necessary. 163 164Some newer version of IIS have additional data in the exported .key 165files. To use these with the utility, view the file with a binary editor 166and look for the string "private-key", then trace back to the byte 167sequence 0x30, 0x82 (this is an ASN1 SEQUENCE). Copy all the data 168from this point onwards to another file and use that as the input 169to the B<rsa> utility with the B<-inform NET> option. If you get 170an error after entering the password try the B<-sgckey> option. 171 172=head1 EXAMPLES 173 174To remove the pass phrase on an RSA private key: 175 176 openssl rsa -in key.pem -out keyout.pem 177 178To encrypt a private key using triple DES: 179 180 openssl rsa -in key.pem -des3 -out keyout.pem 181 182To convert a private key from PEM to DER format: 183 184 openssl rsa -in key.pem -outform DER -out keyout.der 185 186To print out the components of a private key to standard output: 187 188 openssl rsa -in key.pem -text -noout 189 190To just output the public part of a private key: 191 192 openssl rsa -in key.pem -pubout -out pubkey.pem 193 194Output the public part of a private key in B<RSAPublicKey> format: 195 196 openssl rsa -in key.pem -RSAPublicKey_out -out pubkey.pem 197 198=head1 BUGS 199 200The command line password arguments don't currently work with 201B<NET> format. 202 203There should be an option that automatically handles .key files, 204without having to manually edit them. 205 206=head1 SEE ALSO 207 208L<pkcs8(1)|pkcs8(1)>, L<dsa(1)|dsa(1)>, L<genrsa(1)|genrsa(1)>, 209L<gendsa(1)|gendsa(1)> 210 211=cut 212