1*b077aed3SPierre Pronchery=pod 2*b077aed3SPierre Pronchery{- OpenSSL::safe::output_do_not_edit_headers(); -} 3*b077aed3SPierre Pronchery 4*b077aed3SPierre Pronchery=head1 NAME 5*b077aed3SPierre Pronchery 6*b077aed3SPierre Proncheryopenssl-enc - symmetric cipher routines 7*b077aed3SPierre Pronchery 8*b077aed3SPierre Pronchery=head1 SYNOPSIS 9*b077aed3SPierre Pronchery 10*b077aed3SPierre ProncheryB<openssl> B<enc>|I<cipher> 11*b077aed3SPierre Pronchery[B<-I<cipher>>] 12*b077aed3SPierre Pronchery[B<-help>] 13*b077aed3SPierre Pronchery[B<-list>] 14*b077aed3SPierre Pronchery[B<-ciphers>] 15*b077aed3SPierre Pronchery[B<-in> I<filename>] 16*b077aed3SPierre Pronchery[B<-out> I<filename>] 17*b077aed3SPierre Pronchery[B<-pass> I<arg>] 18*b077aed3SPierre Pronchery[B<-e>] 19*b077aed3SPierre Pronchery[B<-d>] 20*b077aed3SPierre Pronchery[B<-a>] 21*b077aed3SPierre Pronchery[B<-base64>] 22*b077aed3SPierre Pronchery[B<-A>] 23*b077aed3SPierre Pronchery[B<-k> I<password>] 24*b077aed3SPierre Pronchery[B<-kfile> I<filename>] 25*b077aed3SPierre Pronchery[B<-K> I<key>] 26*b077aed3SPierre Pronchery[B<-iv> I<IV>] 27*b077aed3SPierre Pronchery[B<-S> I<salt>] 28*b077aed3SPierre Pronchery[B<-salt>] 29*b077aed3SPierre Pronchery[B<-nosalt>] 30*b077aed3SPierre Pronchery[B<-z>] 31*b077aed3SPierre Pronchery[B<-md> I<digest>] 32*b077aed3SPierre Pronchery[B<-iter> I<count>] 33*b077aed3SPierre Pronchery[B<-pbkdf2>] 34*b077aed3SPierre Pronchery[B<-p>] 35*b077aed3SPierre Pronchery[B<-P>] 36*b077aed3SPierre Pronchery[B<-bufsize> I<number>] 37*b077aed3SPierre Pronchery[B<-nopad>] 38*b077aed3SPierre Pronchery[B<-v>] 39*b077aed3SPierre Pronchery[B<-debug>] 40*b077aed3SPierre Pronchery[B<-none>] 41*b077aed3SPierre Pronchery{- $OpenSSL::safe::opt_engine_synopsis -}{- $OpenSSL::safe::opt_r_synopsis -} 42*b077aed3SPierre Pronchery{- $OpenSSL::safe::opt_provider_synopsis -} 43*b077aed3SPierre Pronchery 44*b077aed3SPierre ProncheryB<openssl> I<cipher> [B<...>] 45*b077aed3SPierre Pronchery 46*b077aed3SPierre Pronchery=head1 DESCRIPTION 47*b077aed3SPierre Pronchery 48*b077aed3SPierre ProncheryThe symmetric cipher commands allow data to be encrypted or decrypted 49*b077aed3SPierre Proncheryusing various block and stream ciphers using keys based on passwords 50*b077aed3SPierre Proncheryor explicitly provided. Base64 encoding or decoding can also be performed 51*b077aed3SPierre Proncheryeither by itself or in addition to the encryption or decryption. 52*b077aed3SPierre Pronchery 53*b077aed3SPierre Pronchery=head1 OPTIONS 54*b077aed3SPierre Pronchery 55*b077aed3SPierre Pronchery=over 4 56*b077aed3SPierre Pronchery 57*b077aed3SPierre Pronchery=item B<-I<cipher>> 58*b077aed3SPierre Pronchery 59*b077aed3SPierre ProncheryThe cipher to use. 60*b077aed3SPierre Pronchery 61*b077aed3SPierre Pronchery=item B<-help> 62*b077aed3SPierre Pronchery 63*b077aed3SPierre ProncheryPrint out a usage message. 64*b077aed3SPierre Pronchery 65*b077aed3SPierre Pronchery=item B<-list> 66*b077aed3SPierre Pronchery 67*b077aed3SPierre ProncheryList all supported ciphers. 68*b077aed3SPierre Pronchery 69*b077aed3SPierre Pronchery=item B<-ciphers> 70*b077aed3SPierre Pronchery 71*b077aed3SPierre ProncheryAlias of -list to display all supported ciphers. 72*b077aed3SPierre Pronchery 73*b077aed3SPierre Pronchery=item B<-in> I<filename> 74*b077aed3SPierre Pronchery 75*b077aed3SPierre ProncheryThe input filename, standard input by default. 76*b077aed3SPierre Pronchery 77*b077aed3SPierre Pronchery=item B<-out> I<filename> 78*b077aed3SPierre Pronchery 79*b077aed3SPierre ProncheryThe output filename, standard output by default. 80*b077aed3SPierre Pronchery 81*b077aed3SPierre Pronchery=item B<-pass> I<arg> 82*b077aed3SPierre Pronchery 83*b077aed3SPierre ProncheryThe password source. For more information about the format of I<arg> 84*b077aed3SPierre Proncherysee L<openssl-passphrase-options(1)>. 85*b077aed3SPierre Pronchery 86*b077aed3SPierre Pronchery=item B<-e> 87*b077aed3SPierre Pronchery 88*b077aed3SPierre ProncheryEncrypt the input data: this is the default. 89*b077aed3SPierre Pronchery 90*b077aed3SPierre Pronchery=item B<-d> 91*b077aed3SPierre Pronchery 92*b077aed3SPierre ProncheryDecrypt the input data. 93*b077aed3SPierre Pronchery 94*b077aed3SPierre Pronchery=item B<-a> 95*b077aed3SPierre Pronchery 96*b077aed3SPierre ProncheryBase64 process the data. This means that if encryption is taking place 97*b077aed3SPierre Proncherythe data is base64 encoded after encryption. If decryption is set then 98*b077aed3SPierre Proncherythe input data is base64 decoded before being decrypted. 99*b077aed3SPierre Pronchery 100*b077aed3SPierre Pronchery=item B<-base64> 101*b077aed3SPierre Pronchery 102*b077aed3SPierre ProncherySame as B<-a> 103*b077aed3SPierre Pronchery 104*b077aed3SPierre Pronchery=item B<-A> 105*b077aed3SPierre Pronchery 106*b077aed3SPierre ProncheryIf the B<-a> option is set then base64 process the data on one line. 107*b077aed3SPierre Pronchery 108*b077aed3SPierre Pronchery=item B<-k> I<password> 109*b077aed3SPierre Pronchery 110*b077aed3SPierre ProncheryThe password to derive the key from. This is for compatibility with previous 111*b077aed3SPierre Proncheryversions of OpenSSL. Superseded by the B<-pass> argument. 112*b077aed3SPierre Pronchery 113*b077aed3SPierre Pronchery=item B<-kfile> I<filename> 114*b077aed3SPierre Pronchery 115*b077aed3SPierre ProncheryRead the password to derive the key from the first line of I<filename>. 116*b077aed3SPierre ProncheryThis is for compatibility with previous versions of OpenSSL. Superseded by 117*b077aed3SPierre Proncherythe B<-pass> argument. 118*b077aed3SPierre Pronchery 119*b077aed3SPierre Pronchery=item B<-md> I<digest> 120*b077aed3SPierre Pronchery 121*b077aed3SPierre ProncheryUse the specified digest to create the key from the passphrase. 122*b077aed3SPierre ProncheryThe default algorithm is sha-256. 123*b077aed3SPierre Pronchery 124*b077aed3SPierre Pronchery=item B<-iter> I<count> 125*b077aed3SPierre Pronchery 126*b077aed3SPierre ProncheryUse a given number of iterations on the password in deriving the encryption key. 127*b077aed3SPierre ProncheryHigh values increase the time required to brute-force the resulting file. 128*b077aed3SPierre ProncheryThis option enables the use of PBKDF2 algorithm to derive the key. 129*b077aed3SPierre Pronchery 130*b077aed3SPierre Pronchery=item B<-pbkdf2> 131*b077aed3SPierre Pronchery 132*b077aed3SPierre ProncheryUse PBKDF2 algorithm with a default iteration count of 10000 133*b077aed3SPierre Proncheryunless otherwise specified by the B<-iter> command line option. 134*b077aed3SPierre Pronchery 135*b077aed3SPierre Pronchery=item B<-nosalt> 136*b077aed3SPierre Pronchery 137*b077aed3SPierre ProncheryDon't use a salt in the key derivation routines. This option B<SHOULD NOT> be 138*b077aed3SPierre Proncheryused except for test purposes or compatibility with ancient versions of 139*b077aed3SPierre ProncheryOpenSSL. 140*b077aed3SPierre Pronchery 141*b077aed3SPierre Pronchery=item B<-salt> 142*b077aed3SPierre Pronchery 143*b077aed3SPierre ProncheryUse salt (randomly generated or provide with B<-S> option) when 144*b077aed3SPierre Proncheryencrypting, this is the default. 145*b077aed3SPierre Pronchery 146*b077aed3SPierre Pronchery=item B<-S> I<salt> 147*b077aed3SPierre Pronchery 148*b077aed3SPierre ProncheryThe actual salt to use: this must be represented as a string of hex digits. 149*b077aed3SPierre ProncheryIf this option is used while encrypting, the same exact value will be needed 150*b077aed3SPierre Proncheryagain during decryption. 151*b077aed3SPierre Pronchery 152*b077aed3SPierre Pronchery=item B<-K> I<key> 153*b077aed3SPierre Pronchery 154*b077aed3SPierre ProncheryThe actual key to use: this must be represented as a string comprised only 155*b077aed3SPierre Proncheryof hex digits. If only the key is specified, the IV must additionally specified 156*b077aed3SPierre Proncheryusing the B<-iv> option. When both a key and a password are specified, the 157*b077aed3SPierre Proncherykey given with the B<-K> option will be used and the IV generated from the 158*b077aed3SPierre Proncherypassword will be taken. It does not make much sense to specify both key 159*b077aed3SPierre Proncheryand password. 160*b077aed3SPierre Pronchery 161*b077aed3SPierre Pronchery=item B<-iv> I<IV> 162*b077aed3SPierre Pronchery 163*b077aed3SPierre ProncheryThe actual IV to use: this must be represented as a string comprised only 164*b077aed3SPierre Proncheryof hex digits. When only the key is specified using the B<-K> option, the 165*b077aed3SPierre ProncheryIV must explicitly be defined. When a password is being specified using 166*b077aed3SPierre Proncheryone of the other options, the IV is generated from this password. 167*b077aed3SPierre Pronchery 168*b077aed3SPierre Pronchery=item B<-p> 169*b077aed3SPierre Pronchery 170*b077aed3SPierre ProncheryPrint out the key and IV used. 171*b077aed3SPierre Pronchery 172*b077aed3SPierre Pronchery=item B<-P> 173*b077aed3SPierre Pronchery 174*b077aed3SPierre ProncheryPrint out the key and IV used then immediately exit: don't do any encryption 175*b077aed3SPierre Proncheryor decryption. 176*b077aed3SPierre Pronchery 177*b077aed3SPierre Pronchery=item B<-bufsize> I<number> 178*b077aed3SPierre Pronchery 179*b077aed3SPierre ProncherySet the buffer size for I/O. 180*b077aed3SPierre Pronchery 181*b077aed3SPierre Pronchery=item B<-nopad> 182*b077aed3SPierre Pronchery 183*b077aed3SPierre ProncheryDisable standard block padding. 184*b077aed3SPierre Pronchery 185*b077aed3SPierre Pronchery=item B<-v> 186*b077aed3SPierre Pronchery 187*b077aed3SPierre ProncheryVerbose print; display some statistics about I/O and buffer sizes. 188*b077aed3SPierre Pronchery 189*b077aed3SPierre Pronchery=item B<-debug> 190*b077aed3SPierre Pronchery 191*b077aed3SPierre ProncheryDebug the BIOs used for I/O. 192*b077aed3SPierre Pronchery 193*b077aed3SPierre Pronchery=item B<-z> 194*b077aed3SPierre Pronchery 195*b077aed3SPierre ProncheryCompress or decompress encrypted data using zlib after encryption or before 196*b077aed3SPierre Proncherydecryption. This option exists only if OpenSSL was compiled with the zlib 197*b077aed3SPierre Proncheryor zlib-dynamic option. 198*b077aed3SPierre Pronchery 199*b077aed3SPierre Pronchery=item B<-none> 200*b077aed3SPierre Pronchery 201*b077aed3SPierre ProncheryUse NULL cipher (no encryption or decryption of input). 202*b077aed3SPierre Pronchery 203*b077aed3SPierre Pronchery{- $OpenSSL::safe::opt_r_item -} 204*b077aed3SPierre Pronchery 205*b077aed3SPierre Pronchery{- $OpenSSL::safe::opt_provider_item -} 206*b077aed3SPierre Pronchery 207*b077aed3SPierre Pronchery{- $OpenSSL::safe::opt_engine_item -} 208*b077aed3SPierre Pronchery 209*b077aed3SPierre Pronchery=back 210*b077aed3SPierre Pronchery 211*b077aed3SPierre Pronchery=head1 NOTES 212*b077aed3SPierre Pronchery 213*b077aed3SPierre ProncheryThe program can be called either as C<openssl I<cipher>> or 214*b077aed3SPierre ProncheryC<openssl enc -I<cipher>>. The first form doesn't work with 215*b077aed3SPierre Proncheryengine-provided ciphers, because this form is processed before the 216*b077aed3SPierre Proncheryconfiguration file is read and any ENGINEs loaded. 217*b077aed3SPierre ProncheryUse the L<openssl-list(1)> command to get a list of supported ciphers. 218*b077aed3SPierre Pronchery 219*b077aed3SPierre ProncheryEngines which provide entirely new encryption algorithms (such as the ccgost 220*b077aed3SPierre Proncheryengine which provides gost89 algorithm) should be configured in the 221*b077aed3SPierre Proncheryconfiguration file. Engines specified on the command line using B<-engine> 222*b077aed3SPierre Proncheryoption can only be used for hardware-assisted implementations of 223*b077aed3SPierre Proncheryciphers which are supported by the OpenSSL core or another engine specified 224*b077aed3SPierre Proncheryin the configuration file. 225*b077aed3SPierre Pronchery 226*b077aed3SPierre ProncheryWhen the enc command lists supported ciphers, ciphers provided by engines, 227*b077aed3SPierre Proncheryspecified in the configuration files are listed too. 228*b077aed3SPierre Pronchery 229*b077aed3SPierre ProncheryA password will be prompted for to derive the key and IV if necessary. 230*b077aed3SPierre Pronchery 231*b077aed3SPierre ProncheryThe B<-salt> option should B<ALWAYS> be used if the key is being derived 232*b077aed3SPierre Proncheryfrom a password unless you want compatibility with previous versions of 233*b077aed3SPierre ProncheryOpenSSL. 234*b077aed3SPierre Pronchery 235*b077aed3SPierre ProncheryWithout the B<-salt> option it is possible to perform efficient dictionary 236*b077aed3SPierre Proncheryattacks on the password and to attack stream cipher encrypted data. The reason 237*b077aed3SPierre Proncheryfor this is that without the salt the same password always generates the same 238*b077aed3SPierre Proncheryencryption key. 239*b077aed3SPierre Pronchery 240*b077aed3SPierre ProncheryWhen the salt is generated at random (that means when encrypting using a 241*b077aed3SPierre Proncherypassphrase without explicit salt given using B<-S> option), the first bytes 242*b077aed3SPierre Proncheryof the encrypted data are reserved to store the salt for later decrypting. 243*b077aed3SPierre Pronchery 244*b077aed3SPierre ProncherySome of the ciphers do not have large keys and others have security 245*b077aed3SPierre Proncheryimplications if not used correctly. A beginner is advised to just use 246*b077aed3SPierre Proncherya strong block cipher, such as AES, in CBC mode. 247*b077aed3SPierre Pronchery 248*b077aed3SPierre ProncheryAll the block ciphers normally use PKCS#5 padding, also known as standard 249*b077aed3SPierre Proncheryblock padding. This allows a rudimentary integrity or password check to 250*b077aed3SPierre Proncherybe performed. However, since the chance of random data passing the test 251*b077aed3SPierre Proncheryis better than 1 in 256 it isn't a very good test. 252*b077aed3SPierre Pronchery 253*b077aed3SPierre ProncheryIf padding is disabled then the input data must be a multiple of the cipher 254*b077aed3SPierre Proncheryblock length. 255*b077aed3SPierre Pronchery 256*b077aed3SPierre ProncheryAll RC2 ciphers have the same key and effective key length. 257*b077aed3SPierre Pronchery 258*b077aed3SPierre ProncheryBlowfish and RC5 algorithms use a 128 bit key. 259*b077aed3SPierre Pronchery 260*b077aed3SPierre ProncheryPlease note that OpenSSL 3.0 changed the effect of the B<-S> option. 261*b077aed3SPierre ProncheryAny explicit salt value specified via this option is no longer prepended to the 262*b077aed3SPierre Proncheryciphertext when encrypting, and must again be explicitly provided when decrypting. 263*b077aed3SPierre ProncheryConversely, when the B<-S> option is used during decryption, the ciphertext 264*b077aed3SPierre Proncheryis expected to not have a prepended salt value. 265*b077aed3SPierre Pronchery 266*b077aed3SPierre ProncheryWhen using OpenSSL 3.0 or later to decrypt data that was encrypted with an 267*b077aed3SPierre Proncheryexplicit salt under OpenSSL 1.1.1 do not use the B<-S> option, the salt will 268*b077aed3SPierre Proncherythen be read from the ciphertext. 269*b077aed3SPierre ProncheryTo generate ciphertext that can be decrypted with OpenSSL 1.1.1 do not use 270*b077aed3SPierre Proncherythe B<-S> option, the salt will be then be generated randomly and prepended 271*b077aed3SPierre Proncheryto the output. 272*b077aed3SPierre Pronchery 273*b077aed3SPierre Pronchery=head1 SUPPORTED CIPHERS 274*b077aed3SPierre Pronchery 275*b077aed3SPierre ProncheryNote that some of these ciphers can be disabled at compile time 276*b077aed3SPierre Proncheryand some are available only if an appropriate engine is configured 277*b077aed3SPierre Proncheryin the configuration file. The output when invoking this command 278*b077aed3SPierre Proncherywith the B<-list> option (that is C<openssl enc -list>) is 279*b077aed3SPierre Proncherya list of ciphers, supported by your version of OpenSSL, including 280*b077aed3SPierre Proncheryones provided by configured engines. 281*b077aed3SPierre Pronchery 282*b077aed3SPierre ProncheryThis command does not support authenticated encryption modes 283*b077aed3SPierre Proncherylike CCM and GCM, and will not support such modes in the future. 284*b077aed3SPierre ProncheryThis is due to having to begin streaming output (e.g., to standard output 285*b077aed3SPierre Proncherywhen B<-out> is not used) before the authentication tag could be validated. 286*b077aed3SPierre ProncheryWhen this command is used in a pipeline, the receiving end will not be 287*b077aed3SPierre Proncheryable to roll back upon authentication failure. The AEAD modes currently in 288*b077aed3SPierre Proncherycommon use also suffer from catastrophic failure of confidentiality and/or 289*b077aed3SPierre Proncheryintegrity upon reuse of key/iv/nonce, and since B<openssl enc> places the 290*b077aed3SPierre Proncheryentire burden of key/iv/nonce management upon the user, the risk of 291*b077aed3SPierre Proncheryexposing AEAD modes is too great to allow. These key/iv/nonce 292*b077aed3SPierre Proncherymanagement issues also affect other modes currently exposed in this command, 293*b077aed3SPierre Proncherybut the failure modes are less extreme in these cases, and the 294*b077aed3SPierre Proncheryfunctionality cannot be removed with a stable release branch. 295*b077aed3SPierre ProncheryFor bulk encryption of data, whether using authenticated encryption 296*b077aed3SPierre Proncherymodes or other modes, L<openssl-cms(1)> is recommended, as it provides a 297*b077aed3SPierre Proncherystandard data format and performs the needed key/iv/nonce management. 298*b077aed3SPierre Pronchery 299*b077aed3SPierre Pronchery 300*b077aed3SPierre Pronchery base64 Base 64 301*b077aed3SPierre Pronchery 302*b077aed3SPierre Pronchery bf-cbc Blowfish in CBC mode 303*b077aed3SPierre Pronchery bf Alias for bf-cbc 304*b077aed3SPierre Pronchery blowfish Alias for bf-cbc 305*b077aed3SPierre Pronchery bf-cfb Blowfish in CFB mode 306*b077aed3SPierre Pronchery bf-ecb Blowfish in ECB mode 307*b077aed3SPierre Pronchery bf-ofb Blowfish in OFB mode 308*b077aed3SPierre Pronchery 309*b077aed3SPierre Pronchery cast-cbc CAST in CBC mode 310*b077aed3SPierre Pronchery cast Alias for cast-cbc 311*b077aed3SPierre Pronchery cast5-cbc CAST5 in CBC mode 312*b077aed3SPierre Pronchery cast5-cfb CAST5 in CFB mode 313*b077aed3SPierre Pronchery cast5-ecb CAST5 in ECB mode 314*b077aed3SPierre Pronchery cast5-ofb CAST5 in OFB mode 315*b077aed3SPierre Pronchery 316*b077aed3SPierre Pronchery chacha20 ChaCha20 algorithm 317*b077aed3SPierre Pronchery 318*b077aed3SPierre Pronchery des-cbc DES in CBC mode 319*b077aed3SPierre Pronchery des Alias for des-cbc 320*b077aed3SPierre Pronchery des-cfb DES in CFB mode 321*b077aed3SPierre Pronchery des-ofb DES in OFB mode 322*b077aed3SPierre Pronchery des-ecb DES in ECB mode 323*b077aed3SPierre Pronchery 324*b077aed3SPierre Pronchery des-ede-cbc Two key triple DES EDE in CBC mode 325*b077aed3SPierre Pronchery des-ede Two key triple DES EDE in ECB mode 326*b077aed3SPierre Pronchery des-ede-cfb Two key triple DES EDE in CFB mode 327*b077aed3SPierre Pronchery des-ede-ofb Two key triple DES EDE in OFB mode 328*b077aed3SPierre Pronchery 329*b077aed3SPierre Pronchery des-ede3-cbc Three key triple DES EDE in CBC mode 330*b077aed3SPierre Pronchery des-ede3 Three key triple DES EDE in ECB mode 331*b077aed3SPierre Pronchery des3 Alias for des-ede3-cbc 332*b077aed3SPierre Pronchery des-ede3-cfb Three key triple DES EDE CFB mode 333*b077aed3SPierre Pronchery des-ede3-ofb Three key triple DES EDE in OFB mode 334*b077aed3SPierre Pronchery 335*b077aed3SPierre Pronchery desx DESX algorithm. 336*b077aed3SPierre Pronchery 337*b077aed3SPierre Pronchery gost89 GOST 28147-89 in CFB mode (provided by ccgost engine) 338*b077aed3SPierre Pronchery gost89-cnt GOST 28147-89 in CNT mode (provided by ccgost engine) 339*b077aed3SPierre Pronchery 340*b077aed3SPierre Pronchery idea-cbc IDEA algorithm in CBC mode 341*b077aed3SPierre Pronchery idea same as idea-cbc 342*b077aed3SPierre Pronchery idea-cfb IDEA in CFB mode 343*b077aed3SPierre Pronchery idea-ecb IDEA in ECB mode 344*b077aed3SPierre Pronchery idea-ofb IDEA in OFB mode 345*b077aed3SPierre Pronchery 346*b077aed3SPierre Pronchery rc2-cbc 128 bit RC2 in CBC mode 347*b077aed3SPierre Pronchery rc2 Alias for rc2-cbc 348*b077aed3SPierre Pronchery rc2-cfb 128 bit RC2 in CFB mode 349*b077aed3SPierre Pronchery rc2-ecb 128 bit RC2 in ECB mode 350*b077aed3SPierre Pronchery rc2-ofb 128 bit RC2 in OFB mode 351*b077aed3SPierre Pronchery rc2-64-cbc 64 bit RC2 in CBC mode 352*b077aed3SPierre Pronchery rc2-40-cbc 40 bit RC2 in CBC mode 353*b077aed3SPierre Pronchery 354*b077aed3SPierre Pronchery rc4 128 bit RC4 355*b077aed3SPierre Pronchery rc4-64 64 bit RC4 356*b077aed3SPierre Pronchery rc4-40 40 bit RC4 357*b077aed3SPierre Pronchery 358*b077aed3SPierre Pronchery rc5-cbc RC5 cipher in CBC mode 359*b077aed3SPierre Pronchery rc5 Alias for rc5-cbc 360*b077aed3SPierre Pronchery rc5-cfb RC5 cipher in CFB mode 361*b077aed3SPierre Pronchery rc5-ecb RC5 cipher in ECB mode 362*b077aed3SPierre Pronchery rc5-ofb RC5 cipher in OFB mode 363*b077aed3SPierre Pronchery 364*b077aed3SPierre Pronchery seed-cbc SEED cipher in CBC mode 365*b077aed3SPierre Pronchery seed Alias for seed-cbc 366*b077aed3SPierre Pronchery seed-cfb SEED cipher in CFB mode 367*b077aed3SPierre Pronchery seed-ecb SEED cipher in ECB mode 368*b077aed3SPierre Pronchery seed-ofb SEED cipher in OFB mode 369*b077aed3SPierre Pronchery 370*b077aed3SPierre Pronchery sm4-cbc SM4 cipher in CBC mode 371*b077aed3SPierre Pronchery sm4 Alias for sm4-cbc 372*b077aed3SPierre Pronchery sm4-cfb SM4 cipher in CFB mode 373*b077aed3SPierre Pronchery sm4-ctr SM4 cipher in CTR mode 374*b077aed3SPierre Pronchery sm4-ecb SM4 cipher in ECB mode 375*b077aed3SPierre Pronchery sm4-ofb SM4 cipher in OFB mode 376*b077aed3SPierre Pronchery 377*b077aed3SPierre Pronchery aes-[128|192|256]-cbc 128/192/256 bit AES in CBC mode 378*b077aed3SPierre Pronchery aes[128|192|256] Alias for aes-[128|192|256]-cbc 379*b077aed3SPierre Pronchery aes-[128|192|256]-cfb 128/192/256 bit AES in 128 bit CFB mode 380*b077aed3SPierre Pronchery aes-[128|192|256]-cfb1 128/192/256 bit AES in 1 bit CFB mode 381*b077aed3SPierre Pronchery aes-[128|192|256]-cfb8 128/192/256 bit AES in 8 bit CFB mode 382*b077aed3SPierre Pronchery aes-[128|192|256]-ctr 128/192/256 bit AES in CTR mode 383*b077aed3SPierre Pronchery aes-[128|192|256]-ecb 128/192/256 bit AES in ECB mode 384*b077aed3SPierre Pronchery aes-[128|192|256]-ofb 128/192/256 bit AES in OFB mode 385*b077aed3SPierre Pronchery 386*b077aed3SPierre Pronchery aria-[128|192|256]-cbc 128/192/256 bit ARIA in CBC mode 387*b077aed3SPierre Pronchery aria[128|192|256] Alias for aria-[128|192|256]-cbc 388*b077aed3SPierre Pronchery aria-[128|192|256]-cfb 128/192/256 bit ARIA in 128 bit CFB mode 389*b077aed3SPierre Pronchery aria-[128|192|256]-cfb1 128/192/256 bit ARIA in 1 bit CFB mode 390*b077aed3SPierre Pronchery aria-[128|192|256]-cfb8 128/192/256 bit ARIA in 8 bit CFB mode 391*b077aed3SPierre Pronchery aria-[128|192|256]-ctr 128/192/256 bit ARIA in CTR mode 392*b077aed3SPierre Pronchery aria-[128|192|256]-ecb 128/192/256 bit ARIA in ECB mode 393*b077aed3SPierre Pronchery aria-[128|192|256]-ofb 128/192/256 bit ARIA in OFB mode 394*b077aed3SPierre Pronchery 395*b077aed3SPierre Pronchery camellia-[128|192|256]-cbc 128/192/256 bit Camellia in CBC mode 396*b077aed3SPierre Pronchery camellia[128|192|256] Alias for camellia-[128|192|256]-cbc 397*b077aed3SPierre Pronchery camellia-[128|192|256]-cfb 128/192/256 bit Camellia in 128 bit CFB mode 398*b077aed3SPierre Pronchery camellia-[128|192|256]-cfb1 128/192/256 bit Camellia in 1 bit CFB mode 399*b077aed3SPierre Pronchery camellia-[128|192|256]-cfb8 128/192/256 bit Camellia in 8 bit CFB mode 400*b077aed3SPierre Pronchery camellia-[128|192|256]-ctr 128/192/256 bit Camellia in CTR mode 401*b077aed3SPierre Pronchery camellia-[128|192|256]-ecb 128/192/256 bit Camellia in ECB mode 402*b077aed3SPierre Pronchery camellia-[128|192|256]-ofb 128/192/256 bit Camellia in OFB mode 403*b077aed3SPierre Pronchery 404*b077aed3SPierre Pronchery=head1 EXAMPLES 405*b077aed3SPierre Pronchery 406*b077aed3SPierre ProncheryJust base64 encode a binary file: 407*b077aed3SPierre Pronchery 408*b077aed3SPierre Pronchery openssl base64 -in file.bin -out file.b64 409*b077aed3SPierre Pronchery 410*b077aed3SPierre ProncheryDecode the same file 411*b077aed3SPierre Pronchery 412*b077aed3SPierre Pronchery openssl base64 -d -in file.b64 -out file.bin 413*b077aed3SPierre Pronchery 414*b077aed3SPierre ProncheryEncrypt a file using AES-128 using a prompted password 415*b077aed3SPierre Proncheryand PBKDF2 key derivation: 416*b077aed3SPierre Pronchery 417*b077aed3SPierre Pronchery openssl enc -aes128 -pbkdf2 -in file.txt -out file.aes128 418*b077aed3SPierre Pronchery 419*b077aed3SPierre ProncheryDecrypt a file using a supplied password: 420*b077aed3SPierre Pronchery 421*b077aed3SPierre Pronchery openssl enc -aes128 -pbkdf2 -d -in file.aes128 -out file.txt \ 422*b077aed3SPierre Pronchery -pass pass:<password> 423*b077aed3SPierre Pronchery 424*b077aed3SPierre ProncheryEncrypt a file then base64 encode it (so it can be sent via mail for example) 425*b077aed3SPierre Proncheryusing AES-256 in CTR mode and PBKDF2 key derivation: 426*b077aed3SPierre Pronchery 427*b077aed3SPierre Pronchery openssl enc -aes-256-ctr -pbkdf2 -a -in file.txt -out file.aes256 428*b077aed3SPierre Pronchery 429*b077aed3SPierre ProncheryBase64 decode a file then decrypt it using a password supplied in a file: 430*b077aed3SPierre Pronchery 431*b077aed3SPierre Pronchery openssl enc -aes-256-ctr -pbkdf2 -d -a -in file.aes256 -out file.txt \ 432*b077aed3SPierre Pronchery -pass file:<passfile> 433*b077aed3SPierre Pronchery 434*b077aed3SPierre Pronchery=head1 BUGS 435*b077aed3SPierre Pronchery 436*b077aed3SPierre ProncheryThe B<-A> option when used with large files doesn't work properly. 437*b077aed3SPierre Pronchery 438*b077aed3SPierre ProncheryThe B<openssl enc> command only supports a fixed number of algorithms with 439*b077aed3SPierre Proncherycertain parameters. So if, for example, you want to use RC2 with a 440*b077aed3SPierre Pronchery76 bit key or RC4 with an 84 bit key you can't use this program. 441*b077aed3SPierre Pronchery 442*b077aed3SPierre Pronchery=head1 HISTORY 443*b077aed3SPierre Pronchery 444*b077aed3SPierre ProncheryThe default digest was changed from MD5 to SHA256 in OpenSSL 1.1.0. 445*b077aed3SPierre Pronchery 446*b077aed3SPierre ProncheryThe B<-list> option was added in OpenSSL 1.1.1e. 447*b077aed3SPierre Pronchery 448*b077aed3SPierre ProncheryThe B<-ciphers> and B<-engine> options were deprecated in OpenSSL 3.0. 449*b077aed3SPierre Pronchery 450*b077aed3SPierre Pronchery=head1 COPYRIGHT 451*b077aed3SPierre Pronchery 452*b077aed3SPierre ProncheryCopyright 2000-2023 The OpenSSL Project Authors. All Rights Reserved. 453*b077aed3SPierre Pronchery 454*b077aed3SPierre ProncheryLicensed under the Apache License 2.0 (the "License"). You may not use 455*b077aed3SPierre Proncherythis file except in compliance with the License. You can obtain a copy 456*b077aed3SPierre Proncheryin the file LICENSE in the source distribution or at 457*b077aed3SPierre ProncheryL<https://www.openssl.org/source/license.html>. 458*b077aed3SPierre Pronchery 459*b077aed3SPierre Pronchery=cut 460