1 1.1 christos =pod 2 1.1 christos 3 1.1 christos =begin comment 4 1.1 christos {- join("\n", @autowarntext) -} 5 1.1 christos 6 1.1 christos =end comment 7 1.1 christos 8 1.1 christos =head1 NAME 9 1.1 christos 10 1.1 christos openssl-rsa - RSA key processing command 11 1.1 christos 12 1.1 christos =head1 SYNOPSIS 13 1.1 christos 14 1.1 christos B<openssl> B<rsa> 15 1.1 christos [B<-help>] 16 1.1 christos [B<-inform> B<DER>|B<PEM>|B<P12>|B<ENGINE>] 17 1.1 christos [B<-outform> B<DER>|B<PEM>] 18 1.1 christos [B<-in> I<filename>|I<uri>] 19 1.1 christos [B<-passin> I<arg>] 20 1.1 christos [B<-out> I<filename>] 21 1.1 christos [B<-passout> I<arg>] 22 1.1 christos [B<-aes128>] 23 1.1 christos [B<-aes192>] 24 1.1 christos [B<-aes256>] 25 1.1 christos [B<-aria128>] 26 1.1 christos [B<-aria192>] 27 1.1 christos [B<-aria256>] 28 1.1 christos [B<-camellia128>] 29 1.1 christos [B<-camellia192>] 30 1.1 christos [B<-camellia256>] 31 1.1 christos [B<-des>] 32 1.1 christos [B<-des3>] 33 1.1 christos [B<-idea>] 34 1.1 christos [B<-text>] 35 1.1 christos [B<-noout>] 36 1.1 christos [B<-modulus>] 37 1.1 christos [B<-traditional>] 38 1.1 christos [B<-check>] 39 1.1 christos [B<-pubin>] 40 1.1 christos [B<-pubout>] 41 1.1 christos [B<-RSAPublicKey_in>] 42 1.1 christos [B<-RSAPublicKey_out>] 43 1.1 christos [B<-pvk-strong>] 44 1.1 christos [B<-pvk-weak>] 45 1.1 christos [B<-pvk-none>] 46 1.1 christos {- $OpenSSL::safe::opt_engine_synopsis -}{- $OpenSSL::safe::opt_provider_synopsis -} 47 1.1 christos 48 1.1 christos =head1 DESCRIPTION 49 1.1 christos 50 1.1 christos This command processes RSA keys. They can be converted between 51 1.1 christos various forms and their components printed out. 52 1.1 christos 53 1.1 christos =head1 OPTIONS 54 1.1 christos 55 1.1 christos =over 4 56 1.1 christos 57 1.1 christos =item B<-help> 58 1.1 christos 59 1.1 christos Print out a usage message. 60 1.1 christos 61 1.1 christos =item B<-inform> B<DER>|B<PEM>|B<P12>|B<ENGINE> 62 1.1 christos 63 1.1 christos The key input format; unspecified by default. 64 1.1 christos See L<openssl-format-options(1)> for details. 65 1.1 christos 66 1.1 christos =item B<-outform> B<DER>|B<PEM> 67 1.1 christos 68 1.1 christos The key output format; the default is B<PEM>. 69 1.1 christos See L<openssl-format-options(1)> for details. 70 1.1 christos 71 1.1 christos =item B<-traditional> 72 1.1 christos 73 1.1 christos When writing a private key, use the traditional PKCS#1 format 74 1.1 christos instead of the PKCS#8 format. 75 1.1 christos 76 1.1 christos =item B<-in> I<filename>|I<uri> 77 1.1 christos 78 1.1 christos This specifies the input to read a key from or standard input if this 79 1.1 christos option is not specified. If the key is encrypted a pass phrase will be 80 1.1 christos prompted for. 81 1.1 christos 82 1.1 christos =item B<-passin> I<arg>, B<-passout> I<arg> 83 1.1 christos 84 1.1 christos The password source for the input and output file. 85 1.1 christos For more information about the format of B<arg> 86 1.1 christos see L<openssl-passphrase-options(1)>. 87 1.1 christos 88 1.1 christos =item B<-out> I<filename> 89 1.1 christos 90 1.1 christos This specifies the output filename to write a key to or standard output if this 91 1.1 christos option is not specified. If any encryption options are set then a pass phrase 92 1.1 christos will be prompted for. The output filename should B<not> be the same as the input 93 1.1 christos filename. 94 1.1 christos 95 1.1 christos =item B<-aes128>, B<-aes192>, B<-aes256>, B<-aria128>, B<-aria192>, B<-aria256>, B<-camellia128>, B<-camellia192>, B<-camellia256>, B<-des>, B<-des3>, B<-idea> 96 1.1 christos 97 1.1 christos These options encrypt the private key with the specified 98 1.1 christos cipher before outputting it. A pass phrase is prompted for. 99 1.1 christos If none of these options is specified the key is written in plain text. This 100 1.1 christos means that this command can be used to remove the pass phrase from a key 101 1.1 christos by not giving any encryption option is given, or to add or change the pass 102 1.1 christos phrase by setting them. 103 1.1 christos These options can only be used with PEM format output files. 104 1.1 christos 105 1.1 christos =item B<-text> 106 1.1 christos 107 1.1 christos Prints out the various public or private key components in 108 1.1 christos plain text in addition to the encoded version. 109 1.1 christos 110 1.1 christos =item B<-noout> 111 1.1 christos 112 1.1 christos This option prevents output of the encoded version of the key. 113 1.1 christos 114 1.1 christos =item B<-modulus> 115 1.1 christos 116 1.1 christos This option prints out the value of the modulus of the key. 117 1.1 christos 118 1.1 christos =item B<-check> 119 1.1 christos 120 1.1 christos This option checks the consistency of an RSA private key. 121 1.1 christos 122 1.1 christos =item B<-pubin> 123 1.1 christos 124 1.1 christos By default a private key is read from the input. 125 1.1 christos With this option a public key is read instead. 126 1.1 christos If the input contains no public key but a private key, its public part is used. 127 1.1 christos 128 1.1 christos =item B<-pubout> 129 1.1 christos 130 1.1 christos By default a private key is output: with this option a public 131 1.1 christos key will be output instead. This option is automatically set if 132 1.1 christos the input is a public key. 133 1.1 christos 134 1.1 christos =item B<-RSAPublicKey_in>, B<-RSAPublicKey_out> 135 1.1 christos 136 1.1 christos Like B<-pubin> and B<-pubout> except B<RSAPublicKey> format is used instead. 137 1.1 christos 138 1.1 christos =item B<-pvk-strong> 139 1.1 christos 140 1.1 christos Enable 'Strong' PVK encoding level (default). 141 1.1 christos 142 1.1 christos =item B<-pvk-weak> 143 1.1 christos 144 1.1 christos Enable 'Weak' PVK encoding level. 145 1.1 christos 146 1.1 christos =item B<-pvk-none> 147 1.1 christos 148 1.1 christos Don't enforce PVK encoding. 149 1.1 christos 150 1.1 christos {- $OpenSSL::safe::opt_engine_item -} 151 1.1 christos 152 1.1 christos {- $OpenSSL::safe::opt_provider_item -} 153 1.1 christos 154 1.1 christos =back 155 1.1 christos 156 1.1 christos =head1 NOTES 157 1.1 christos 158 1.1 christos The L<openssl-pkey(1)> command is capable of performing all the operations 159 1.1 christos this command can, as well as supporting other public key types. 160 1.1 christos 161 1.1 christos =head1 EXAMPLES 162 1.1 christos 163 1.1 christos The documentation for the L<openssl-pkey(1)> command contains examples 164 1.1 christos equivalent to the ones listed here. 165 1.1 christos 166 1.1 christos To remove the pass phrase on an RSA private key: 167 1.1 christos 168 1.1 christos openssl rsa -in key.pem -out keyout.pem 169 1.1 christos 170 1.1 christos To encrypt a private key using triple DES: 171 1.1 christos 172 1.1 christos openssl rsa -in key.pem -des3 -out keyout.pem 173 1.1 christos 174 1.1 christos To convert a private key from PEM to DER format: 175 1.1 christos 176 1.1 christos openssl rsa -in key.pem -outform DER -out keyout.der 177 1.1 christos 178 1.1 christos To print out the components of a private key to standard output: 179 1.1 christos 180 1.1 christos openssl rsa -in key.pem -text -noout 181 1.1 christos 182 1.1 christos To just output the public part of a private key: 183 1.1 christos 184 1.1 christos openssl rsa -in key.pem -pubout -out pubkey.pem 185 1.1 christos 186 1.1 christos Output the public part of a private key in B<RSAPublicKey> format: 187 1.1 christos 188 1.1 christos openssl rsa -in key.pem -RSAPublicKey_out -out pubkey.pem 189 1.1 christos 190 1.1 christos =head1 BUGS 191 1.1 christos 192 1.1 christos There should be an option that automatically handles F<.key> files, 193 1.1 christos without having to manually edit them. 194 1.1 christos 195 1.1 christos =head1 SEE ALSO 196 1.1 christos 197 1.1 christos L<openssl(1)>, 198 1.1 christos L<openssl-pkey(1)>, 199 1.1 christos L<openssl-pkcs8(1)>, 200 1.1 christos L<openssl-dsa(1)>, 201 1.1 christos L<openssl-genrsa(1)>, 202 1.1 christos L<openssl-gendsa(1)> 203 1.1 christos 204 1.1 christos =head1 HISTORY 205 1.1 christos 206 1.1 christos The B<-engine> option was deprecated in OpenSSL 3.0. 207 1.1 christos 208 1.1 christos =head1 COPYRIGHT 209 1.1 christos 210 1.1 christos Copyright 2000-2023 The OpenSSL Project Authors. All Rights Reserved. 211 1.1 christos 212 1.1 christos Licensed under the Apache License 2.0 (the "License"). You may not use 213 1.1 christos this file except in compliance with the License. You can obtain a copy 214 1.1 christos in the file LICENSE in the source distribution or at 215 1.1 christos L<https://www.openssl.org/source/license.html>. 216 1.1 christos 217 1.1 christos =cut 218