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       The enc program does not support authenticated encryption modes like
163       CCM and GCM. The utility does not store or retrieve the authentication
164       tag.
165
166        base64             Base 64
167
168        bf-cbc             Blowfish in CBC mode
169        bf                 Alias for bf-cbc
170        bf-cfb             Blowfish in CFB mode
171        bf-ecb             Blowfish in ECB mode
172        bf-ofb             Blowfish in OFB mode
173
174        cast-cbc           CAST in CBC mode
175        cast               Alias for cast-cbc
176        cast5-cbc          CAST5 in CBC mode
177        cast5-cfb          CAST5 in CFB mode
178        cast5-ecb          CAST5 in ECB mode
179        cast5-ofb          CAST5 in OFB mode
180
181        des-cbc            DES in CBC mode
182        des                Alias for des-cbc
183        des-cfb            DES in CBC mode
184        des-ofb            DES in OFB mode
185        des-ecb            DES in ECB mode
186
187        des-ede-cbc        Two key triple DES EDE in CBC mode
188        des-ede            Two key triple DES EDE in ECB mode
189        des-ede-cfb        Two key triple DES EDE in CFB mode
190        des-ede-ofb        Two key triple DES EDE in OFB mode
191
192        des-ede3-cbc       Three key triple DES EDE in CBC mode
193        des-ede3           Three key triple DES EDE in ECB mode
194        des3               Alias for des-ede3-cbc
195        des-ede3-cfb       Three key triple DES EDE CFB mode
196        des-ede3-ofb       Three key triple DES EDE in OFB mode
197
198        desx               DESX algorithm.
199
200        gost89             GOST 28147-89 in CFB mode (provided by ccgost engine)
201        gost89-cnt        `GOST 28147-89 in CNT mode (provided by ccgost engine)
202
203        idea-cbc           IDEA algorithm in CBC mode
204        idea               same as idea-cbc
205        idea-cfb           IDEA in CFB mode
206        idea-ecb           IDEA in ECB mode
207        idea-ofb           IDEA in OFB mode
208
209        rc2-cbc            128 bit RC2 in CBC mode
210        rc2                Alias for rc2-cbc
211        rc2-cfb            128 bit RC2 in CFB mode
212        rc2-ecb            128 bit RC2 in ECB mode
213        rc2-ofb            128 bit RC2 in OFB mode
214        rc2-64-cbc         64 bit RC2 in CBC mode
215        rc2-40-cbc         40 bit RC2 in CBC mode
216
217        rc4                128 bit RC4
218        rc4-64             64 bit RC4
219        rc4-40             40 bit RC4
220
221        rc5-cbc            RC5 cipher in CBC mode
222        rc5                Alias for rc5-cbc
223        rc5-cfb            RC5 cipher in CFB mode
224        rc5-ecb            RC5 cipher in ECB mode
225        rc5-ofb            RC5 cipher in OFB mode
226
227        aes-[128|192|256]-cbc  128/192/256 bit AES in CBC mode
228        aes-[128|192|256]      Alias for aes-[128|192|256]-cbc
229        aes-[128|192|256]-cfb  128/192/256 bit AES in 128 bit CFB mode
230        aes-[128|192|256]-cfb1 128/192/256 bit AES in 1 bit CFB mode
231        aes-[128|192|256]-cfb8 128/192/256 bit AES in 8 bit CFB mode
232        aes-[128|192|256]-ecb  128/192/256 bit AES in ECB mode
233        aes-[128|192|256]-ofb  128/192/256 bit AES in OFB mode
234

EXAMPLES

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

BUGS

266       The -A option when used with large files doesn't work properly.
267
268       There should be an option to allow an iteration count to be included.
269
270       The enc program only supports a fixed number of algorithms with certain
271       parameters. So if, for example, you want to use RC2 with a 76 bit key
272       or RC4 with an 84 bit key you can't use this program.
273
274
275
2761.0.2k                            2017-01-26                            ENC(1)
Impressum