1ENC(1)                              OpenSSL                             ENC(1)
2
3
4

NAME

6       enc - symmetric cipher routines
7

SYNOPSIS

9       openssl enc -ciphername [-in filename] [-out filename] [-pass arg] [-e]
10       [-d] [-a/-base64] [-A] [-k password] [-kfile filename] [-K key] [-iv
11       IV] [-S salt] [-salt] [-nosalt] [-z] [-md] [-p] [-P] [-bufsize number]
12       [-nopad] [-debug] [-none] [-engine id]
13

DESCRIPTION

15       The symmetric cipher commands allow data to be encrypted or decrypted
16       using various block and stream ciphers using keys based on passwords or
17       explicitly provided. Base64 encoding or decoding can also be performed
18       either by itself or in addition to the encryption or decryption.
19

OPTIONS

21       -in filename
22           the input filename, standard input by default.
23
24       -out filename
25           the output filename, standard output by default.
26
27       -pass arg
28           the password source. For more information about the format of arg
29           see the PASS PHRASE ARGUMENTS section in openssl(1).
30
31       -salt
32           use a salt in the key derivation routines. This is the default.
33
34       -nosalt
35           don't use a salt in the key derivation routines. This option SHOULD
36           NOT be used except for test purposes or compatibility with ancient
37           versions of OpenSSL and SSLeay.
38
39       -e  encrypt the input data: this is the default.
40
41       -d  decrypt the input data.
42
43       -a  base64 process the data. This means that if encryption is taking
44           place the data is base64 encoded after encryption. If decryption is
45           set then the input data is base64 decoded before being decrypted.
46
47       -base64
48           same as -a
49
50       -A  if the -a option is set then base64 process the data on one line.
51
52       -k password
53           the password to derive the key from. This is for compatibility with
54           previous versions of OpenSSL. Superseded by the -pass argument.
55
56       -kfile filename
57           read the password to derive the key from the first line of
58           filename.  This is for compatibility with previous versions of
59           OpenSSL. Superseded by the -pass argument.
60
61       -nosalt
62           do not use a salt
63
64       -salt
65           use salt (randomly generated or provide with -S option) when
66           encrypting (this is the default).
67
68       -S salt
69           the actual salt to use: this must be represented as a string of hex
70           digits.
71
72       -K key
73           the actual key to use: this must be represented as a string
74           comprised only of hex digits. If only the key is specified, the IV
75           must additionally specified using the -iv option. When both a key
76           and a password are specified, the key given with the -K option will
77           be used and the IV generated from the password will be taken. It
78           probably does not make much sense to specify both key and password.
79
80       -iv IV
81           the actual IV to use: this must be represented as a string
82           comprised only of hex digits. When only the key is specified using
83           the -K option, the IV must explicitly be defined. When a password
84           is being specified using one of the other options, the IV is
85           generated from this password.
86
87       -p  print out the key and IV used.
88
89       -P  print out the key and IV used then immediately exit: don't do any
90           encryption or decryption.
91
92       -bufsize number
93           set the buffer size for I/O
94
95       -nopad
96           disable standard block padding
97
98       -debug
99           debug the BIOs used for I/O.
100
101       -z  Compress or decompress clear text using zlib before encryption or
102           after decryption. This option exists only if OpenSSL with compiled
103           with zlib or zlib-dynamic option.
104
105       -none
106           Use NULL cipher (no encryption or decryption of input).
107

NOTES

109       The program can be called either as openssl ciphername or openssl enc
110       -ciphername. But the first form doesn't work with engine-provided
111       ciphers, because this form is processed before the configuration file
112       is read and any ENGINEs loaded.
113
114       Engines which provide entirely new encryption algorithms (such as
115       ccgost engine which provides gost89 algorithm) should be configured in
116       the configuration file. Engines, specified in the command line using
117       -engine options can only be used for hadrware-assisted implementations
118       of ciphers, which are supported by OpenSSL core or other engine,
119       specified in the configuration file.
120
121       When enc command lists supported ciphers, ciphers provided by engines,
122       specified in the configuration files are listed too.
123
124       A password will be prompted for to derive the key and IV if necessary.
125
126       The -salt option should ALWAYS be used if the key is being derived from
127       a password unless you want compatibility with previous versions of
128       OpenSSL and SSLeay.
129
130       Without the -salt option it is possible to perform efficient dictionary
131       attacks on the password and to attack stream cipher encrypted data. The
132       reason for this is that without the salt the same password always
133       generates the same encryption key. When the salt is being used the
134       first eight bytes of the encrypted data are reserved for the salt: it
135       is generated at random when encrypting a file and read from the
136       encrypted file when it is decrypted.
137
138       Some of the ciphers do not have large keys and others have security
139       implications if not used correctly. A beginner is advised to just use a
140       strong block cipher in CBC mode such as bf or des3.
141
142       All the block ciphers normally use PKCS#5 padding also known as
143       standard block padding: this allows a rudimentary integrity or password
144       check to be performed. However since the chance of random data passing
145       the test is better than 1 in 256 it isn't a very good test.
146
147       If padding is disabled then the input data must be a multiple of the
148       cipher block length.
149
150       All RC2 ciphers have the same key and effective key length.
151
152       Blowfish and RC5 algorithms use a 128 bit key.
153

SUPPORTED CIPHERS

155       Note that some of these ciphers can be disabled at compile time and
156       some are available only if an appropriate engine is configured in the
157       configuration file. The output of the enc command run with unsupported
158       options (for example openssl enc -help) includes a list of ciphers,
159       supported by your versesion of OpenSSL, including ones provided by
160       configured engines.
161
162        base64             Base 64
163
164        bf-cbc             Blowfish in CBC mode
165        bf                 Alias for bf-cbc
166        bf-cfb             Blowfish in CFB mode
167        bf-ecb             Blowfish in ECB mode
168        bf-ofb             Blowfish in OFB mode
169
170        cast-cbc           CAST in CBC mode
171        cast               Alias for cast-cbc
172        cast5-cbc          CAST5 in CBC mode
173        cast5-cfb          CAST5 in CFB mode
174        cast5-ecb          CAST5 in ECB mode
175        cast5-ofb          CAST5 in OFB mode
176
177        des-cbc            DES in CBC mode
178        des                Alias for des-cbc
179        des-cfb            DES in CBC mode
180        des-ofb            DES in OFB mode
181        des-ecb            DES in ECB mode
182
183        des-ede-cbc        Two key triple DES EDE in CBC mode
184        des-ede            Two key triple DES EDE in ECB mode
185        des-ede-cfb        Two key triple DES EDE in CFB mode
186        des-ede-ofb        Two key triple DES EDE in OFB mode
187
188        des-ede3-cbc       Three key triple DES EDE in CBC mode
189        des-ede3           Three key triple DES EDE in ECB mode
190        des3               Alias for des-ede3-cbc
191        des-ede3-cfb       Three key triple DES EDE CFB mode
192        des-ede3-ofb       Three key triple DES EDE in OFB mode
193
194        desx               DESX algorithm.
195
196        gost89             GOST 28147-89 in CFB mode (provided by ccgost engine)
197        gost89-cnt        `GOST 28147-89 in CNT mode (provided by ccgost engine)
198
199        idea-cbc           IDEA algorithm in CBC mode
200        idea               same as idea-cbc
201        idea-cfb           IDEA in CFB mode
202        idea-ecb           IDEA in ECB mode
203        idea-ofb           IDEA in OFB mode
204
205        rc2-cbc            128 bit RC2 in CBC mode
206        rc2                Alias for rc2-cbc
207        rc2-cfb            128 bit RC2 in CFB mode
208        rc2-ecb            128 bit RC2 in ECB mode
209        rc2-ofb            128 bit RC2 in OFB mode
210        rc2-64-cbc         64 bit RC2 in CBC mode
211        rc2-40-cbc         40 bit RC2 in CBC mode
212
213        rc4                128 bit RC4
214        rc4-64             64 bit RC4
215        rc4-40             40 bit RC4
216
217        rc5-cbc            RC5 cipher in CBC mode
218        rc5                Alias for rc5-cbc
219        rc5-cfb            RC5 cipher in CFB mode
220        rc5-ecb            RC5 cipher in ECB mode
221        rc5-ofb            RC5 cipher in OFB mode
222
223        aes-[128|192|256]-cbc  128/192/256 bit AES in CBC mode
224        aes-[128|192|256]      Alias for aes-[128|192|256]-cbc
225        aes-[128|192|256]-cfb  128/192/256 bit AES in 128 bit CFB mode
226        aes-[128|192|256]-cfb1 128/192/256 bit AES in 1 bit CFB mode
227        aes-[128|192|256]-cfb8 128/192/256 bit AES in 8 bit CFB mode
228        aes-[128|192|256]-ecb  128/192/256 bit AES in ECB mode
229        aes-[128|192|256]-ofb  128/192/256 bit AES in OFB mode
230

EXAMPLES

232       Just base64 encode a binary file:
233
234        openssl base64 -in file.bin -out file.b64
235
236       Decode the same file
237
238        openssl base64 -d -in file.b64 -out file.bin
239
240       Encrypt a file using triple DES in CBC mode using a prompted password:
241
242        openssl des3 -salt -in file.txt -out file.des3
243
244       Decrypt a file using a supplied password:
245
246        openssl des3 -d -salt -in file.des3 -out file.txt -k mypassword
247
248       Encrypt a file then base64 encode it (so it can be sent via mail for
249       example) using Blowfish in CBC mode:
250
251        openssl bf -a -salt -in file.txt -out file.bf
252
253       Base64 decode a file then decrypt it:
254
255        openssl bf -d -salt -a -in file.bf -out file.txt
256
257       Decrypt some data using a supplied 40 bit RC4 key:
258
259        openssl rc4-40 -in file.rc4 -out file.txt -K 0102030405
260

BUGS

262       The -A option when used with large files doesn't work properly.
263
264       There should be an option to allow an iteration count to be included.
265
266       The enc program only supports a fixed number of algorithms with certain
267       parameters. So if, for example, you want to use RC2 with a 76 bit key
268       or RC4 with an 84 bit key you can't use this program.
269
270
271
2721.0.0e                            2009-09-04                            ENC(1)
Impressum