Debian Codegraph @

upstream/debian-unstable/man1/openssl-enc.1ssl

raw
1 .\" -*- mode: troff; coding: utf-8 -*-
2 .\" Automatically generated by Pod::Man 5.0102 (Pod::Simple 3.45)
3 .\"
4 .\" Standard preamble:
5 .\" ========================================================================
6 .de Sp \" Vertical space (when we can't use .PP)
7 .if t .sp .5v
8 .if n .sp
9 ..
10 .de Vb \" Begin verbatim text
11 .ft CW
12 .nf
13 .ne \\$1
14 ..
15 .de Ve \" End verbatim text
16 .ft R
17 .fi
18 ..
19 .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>.
20 .ie n \{\
21 . ds C` ""
22 . ds C' ""
23 'br\}
24 .el\{\
25 . ds C`
26 . ds C'
27 'br\}
28 .\"
29 .\" Escape single quotes in literal strings from groff's Unicode transform.
30 .ie \n(.g .ds Aq \(aq
31 .el .ds Aq '
32 .\"
33 .\" If the F register is >0, we'll generate index entries on stderr for
34 .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
35 .\" entries marked with X<> in POD. Of course, you'll have to process the
36 .\" output yourself in some meaningful fashion.
37 .\"
38 .\" Avoid warning from groff about undefined register 'F'.
39 .de IX
40 ..
41 .nr rF 0
42 .if \n(.g .if rF .nr rF 1
43 .if (\n(rF:(\n(.g==0)) \{\
44 . if \nF \{\
45 . de IX
46 . tm Index:\\$1\t\\n%\t"\\$2"
47 ..
48 . if !\nF==2 \{\
49 . nr % 0
50 . nr F 2
51 . \}
52 . \}
53 .\}
54 .rr rF
55 .\" ========================================================================
56 .\"
57 .IX Title "OPENSSL-ENC 1SSL"
58 .TH OPENSSL-ENC 1SSL 2026-04-07 3.6.2 OpenSSL
59 .\" For nroff, turn off justification. Always turn off hyphenation; it makes
60 .\" way too many mistakes in technical documents.
61 .if n .ad l
62 .nh
63 .SH NAME
64 openssl\-enc \- symmetric cipher routines
65 .SH SYNOPSIS
66 .IX Header "SYNOPSIS"
67 \&\fBopenssl\fR \fBenc\fR|\fIcipher\fR
68 [\fB\-\fR\f(BIcipher\fR]
69 [\fB\-help\fR]
70 [\fB\-list\fR]
71 [\fB\-ciphers\fR]
72 [\fB\-in\fR \fIfilename\fR]
73 [\fB\-out\fR \fIfilename\fR]
74 [\fB\-pass\fR \fIarg\fR]
75 [\fB\-e\fR]
76 [\fB\-d\fR]
77 [\fB\-a\fR]
78 [\fB\-base64\fR]
79 [\fB\-A\fR]
80 [\fB\-k\fR \fIpassword\fR]
81 [\fB\-kfile\fR \fIfilename\fR]
82 [\fB\-K\fR \fIkey\fR]
83 [\fB\-iv\fR \fIIV\fR]
84 [\fB\-S\fR \fIsalt\fR]
85 [\fB\-salt\fR]
86 [\fB\-nosalt\fR]
87 [\fB\-z\fR]
88 [\fB\-md\fR \fIdigest\fR]
89 [\fB\-iter\fR \fIcount\fR]
90 [\fB\-pbkdf2\fR]
91 [\fB\-saltlen\fR \fIsize\fR]
92 [\fB\-p\fR]
93 [\fB\-P\fR]
94 [\fB\-bufsize\fR \fInumber\fR]
95 [\fB\-nopad\fR]
96 [\fB\-v\fR]
97 [\fB\-debug\fR]
98 [\fB\-none\fR]
99 [\fB\-skeymgmt\fR \fIskeymgmt\fR]
100 [\fB\-skeyopt\fR \fIopt\fR:\fIvalue\fR]
101 [\fB\-engine\fR \fIid\fR]
102 [\fB\-rand\fR \fIfiles\fR]
103 [\fB\-writerand\fR \fIfile\fR]
104 [\fB\-provider\fR \fIname\fR]
105 [\fB\-provider\-path\fR \fIpath\fR]
106 [\fB\-provparam\fR \fI[name:]key=value\fR]
107 [\fB\-propquery\fR \fIpropq\fR]
108 .PP
109 \&\fBopenssl\fR \fIcipher\fR [\fB...\fR]
110 .SH DESCRIPTION
111 .IX Header "DESCRIPTION"
112 The symmetric cipher commands allow data to be encrypted or decrypted
113 using various block and stream ciphers using keys based on passwords
114 or explicitly provided. Base64 encoding or decoding can also be performed
115 either by itself or in addition to the encryption or decryption.
116 .SH OPTIONS
117 .IX Header "OPTIONS"
118 .IP \fB\-\fR\f(BIcipher\fR 4
119 .IX Item "-cipher"
120 The cipher to use.
121 .IP \fB\-help\fR 4
122 .IX Item "-help"
123 Print out a usage message.
124 .IP \fB\-list\fR 4
125 .IX Item "-list"
126 List all supported ciphers.
127 .IP \fB\-ciphers\fR 4
128 .IX Item "-ciphers"
129 Alias of \-list to display all supported ciphers.
130 .IP "\fB\-in\fR \fIfilename\fR" 4
131 .IX Item "-in filename"
132 The input filename, standard input by default.
133 .IP "\fB\-out\fR \fIfilename\fR" 4
134 .IX Item "-out filename"
135 The output filename, standard output by default.
136 .IP "\fB\-pass\fR \fIarg\fR" 4
137 .IX Item "-pass arg"
138 The password source. For more information about the format of \fIarg\fR
139 see \fBopenssl\-passphrase\-options\fR\|(1).
140 .IP \fB\-e\fR 4
141 .IX Item "-e"
142 Encrypt the input data: this is the default.
143 .IP \fB\-d\fR 4
144 .IX Item "-d"
145 Decrypt the input data.
146 .IP \fB\-a\fR 4
147 .IX Item "-a"
148 Base64 process the data. This means that if encryption is taking place
149 the data is base64 encoded after encryption. If decryption is set then
150 the input data is base64 decoded before being decrypted.
151 .Sp
152 When the \fB\-A\fR option not given,
153 on encoding a newline is inserted after each 64 characters, and
154 on decoding a newline is expected among the first 1024 bytes of input.
155 .IP \fB\-base64\fR 4
156 .IX Item "-base64"
157 Same as \fB\-a\fR
158 .IP \fB\-A\fR 4
159 .IX Item "-A"
160 If the \fB\-a\fR option is set then base64 encoding produces output without any
161 newline character, and base64 decoding does not require any newlines.
162 Therefore it can be helpful to use the \fB\-A\fR option when decoding unknown input.
163 .IP "\fB\-k\fR \fIpassword\fR" 4
164 .IX Item "-k password"
165 The password to derive the key from. This is for compatibility with previous
166 versions of OpenSSL. Superseded by the \fB\-pass\fR argument.
167 .IP "\fB\-kfile\fR \fIfilename\fR" 4
168 .IX Item "-kfile filename"
169 Read the password to derive the key from the first line of \fIfilename\fR.
170 This is for compatibility with previous versions of OpenSSL. Superseded by
171 the \fB\-pass\fR argument.
172 .IP "\fB\-md\fR \fIdigest\fR" 4
173 .IX Item "-md digest"
174 Use the specified digest to create the key from the passphrase.
175 The default algorithm is sha\-256.
176 .IP "\fB\-iter\fR \fIcount\fR" 4
177 .IX Item "-iter count"
178 Use a given number of iterations on the password in deriving the encryption key.
179 High values increase the time required to brute-force the resulting file.
180 This option enables the use of PBKDF2 algorithm to derive the key.
181 .IP \fB\-pbkdf2\fR 4
182 .IX Item "-pbkdf2"
183 Use PBKDF2 algorithm with a default iteration count of 10000
184 unless otherwise specified by the \fB\-iter\fR command line option.
185 .IP \fB\-saltlen\fR 4
186 .IX Item "-saltlen"
187 Set the salt length to use when using the \fB\-pbkdf2\fR option.
188 For compatibility reasons, the default is 8 bytes.
189 The maximum value is currently 16 bytes.
190 If the \fB\-pbkdf2\fR option is not used, then this option is ignored
191 and a fixed salt length of 8 is used. The salt length used when
192 encrypting must also be used when decrypting.
193 .IP \fB\-nosalt\fR 4
194 .IX Item "-nosalt"
195 Don't use a salt in the key derivation routines. This option \fBSHOULD NOT\fR be
196 used except for test purposes or compatibility with ancient versions of
197 OpenSSL.
198 .IP \fB\-salt\fR 4
199 .IX Item "-salt"
200 Use salt (randomly generated or provide with \fB\-S\fR option) when
201 encrypting, this is the default.
202 .IP "\fB\-S\fR \fIsalt\fR" 4
203 .IX Item "-S salt"
204 The actual salt to use: this must be represented as a string of hex digits.
205 If this option is used while encrypting, the same exact value will be needed
206 again during decryption. This salt may be truncated or zero padded to
207 match the salt length (See \fB\-saltlen\fR).
208 .IP "\fB\-K\fR \fIkey\fR" 4
209 .IX Item "-K key"
210 The actual key to use: this must be represented as a string comprised only
211 of hex digits. If only the key is specified, the IV must additionally specified
212 using the \fB\-iv\fR option. When both a key and a password are specified, the
213 key given with the \fB\-K\fR option will be used and the IV generated from the
214 password will be taken. It does not make much sense to specify both key
215 and password.
216 .IP "\fB\-iv\fR \fIIV\fR" 4
217 .IX Item "-iv IV"
218 The actual IV to use: this must be represented as a string comprised only
219 of hex digits. When only the key is specified using the \fB\-K\fR option, the
220 IV must explicitly be defined. When a password is being specified using
221 one of the other options, the IV is generated from this password.
222 .IP \fB\-p\fR 4
223 .IX Item "-p"
224 Print out the key and IV used.
225 .IP \fB\-P\fR 4
226 .IX Item "-P"
227 Print out the key and IV used then immediately exit: don't do any encryption
228 or decryption.
229 .IP "\fB\-bufsize\fR \fInumber\fR" 4
230 .IX Item "-bufsize number"
231 Set the buffer size for I/O.
232 .IP \fB\-nopad\fR 4
233 .IX Item "-nopad"
234 Disable standard block padding.
235 .IP \fB\-v\fR 4
236 .IX Item "-v"
237 Verbose print; display some statistics about I/O and buffer sizes.
238 .IP \fB\-debug\fR 4
239 .IX Item "-debug"
240 Debug the BIOs used for I/O.
241 .IP \fB\-z\fR 4
242 .IX Item "-z"
243 Compress or decompress encrypted data using zlib after encryption or before
244 decryption. This option exists only if OpenSSL was compiled with the zlib
245 or zlib-dynamic option.
246 .IP \fB\-none\fR 4
247 .IX Item "-none"
248 Use NULL cipher (no encryption or decryption of input).
249 .IP "\fB\-skeymgmt\fR \fIskeymgmt\fR" 4
250 .IX Item "-skeymgmt skeymgmt"
251 Some providers may support opaque symmetric keys objects. To use them, we need
252 to know the name of the \fBEVP_SKEYMGMT\fR to be used. If not specified, the name
253 of the cipher will be used.
254 .Sp
255 To find out the name of the suitable symmetric key management,
256 please refer to the output of the \f(CW\*(C`openssl list \-skey\-managers\*(C'\fR command.
257 .IP "\fB\-skeyopt\fR \fIopt\fR:\fIvalue\fR" 4
258 .IX Item "-skeyopt opt:value"
259 To obtain an existing opaque symmetric key or generate a new one, key
260 options are specified as opt:value. These options can't be used together with
261 any options implying raw key directly or indirectly.
262 .IP "\fB\-rand\fR \fIfiles\fR, \fB\-writerand\fR \fIfile\fR" 4
263 .IX Item "-rand files, -writerand file"
264 See "Random State Options" in \fBopenssl\fR\|(1) for details.
265 .IP "\fB\-provider\fR \fIname\fR" 4
266 .IX Item "-provider name"
267 .PD 0
268 .IP "\fB\-provider\-path\fR \fIpath\fR" 4
269 .IX Item "-provider-path path"
270 .IP "\fB\-provparam\fR \fI[name:]key=value\fR" 4
271 .IX Item "-provparam [name:]key=value"
272 .IP "\fB\-propquery\fR \fIpropq\fR" 4
273 .IX Item "-propquery propq"
274 .PD
275 See "Provider Options" in \fBopenssl\fR\|(1), \fBprovider\fR\|(7), and \fBproperty\fR\|(7).
276 .IP "\fB\-engine\fR \fIid\fR" 4
277 .IX Item "-engine id"
278 See "Engine Options" in \fBopenssl\fR\|(1).
279 This option is deprecated.
280 .SH NOTES
281 .IX Header "NOTES"
282 The program can be called either as \f(CW\*(C`openssl \fR\f(CIcipher\fR\f(CW\*(C'\fR or
283 \&\f(CW\*(C`openssl enc \-\fR\f(CIcipher\fR\f(CW\*(C'\fR. The first form doesn't work with
284 engine-provided ciphers, because this form is processed before the
285 configuration file is read and any ENGINEs loaded.
286 Use the \fBopenssl\-list\fR\|(1) command to get a list of supported ciphers.
287 .PP
288 Engines which provide entirely new encryption algorithms (such as the ccgost
289 engine which provides gost89 algorithm) should be configured in the
290 configuration file. Engines specified on the command line using \fB\-engine\fR
291 option can only be used for hardware-assisted implementations of
292 ciphers which are supported by the OpenSSL core or another engine specified
293 in the configuration file.
294 .PP
295 When the enc command lists supported ciphers, ciphers provided by engines,
296 specified in the configuration files are listed too.
297 .PP
298 A password will be prompted for to derive the key and IV if necessary.
299 .PP
300 The \fB\-salt\fR option should \fBALWAYS\fR be used if the key is being derived
301 from a password unless you want compatibility with previous versions of
302 OpenSSL.
303 .PP
304 Without the \fB\-salt\fR option it is possible to perform efficient dictionary
305 attacks on the password and to attack stream cipher encrypted data. The reason
306 for this is that without the salt the same password always generates the same
307 encryption key.
308 .PP
309 When the salt is generated at random (that means when encrypting using a
310 passphrase without explicit salt given using \fB\-S\fR option), the first bytes
311 of the encrypted data are reserved to store the salt for later decrypting.
312 .PP
313 Some of the ciphers do not have large keys and others have security
314 implications if not used correctly. A beginner is advised to just use
315 a strong block cipher, such as AES, in CBC mode.
316 .PP
317 All the block ciphers normally use PKCS#7 padding, also known as standard
318 block padding. This allows a rudimentary integrity or password check to
319 be performed. However, since the chance of random data passing the test
320 is better than 1 in 256 it isn't a very good test.
321 .PP
322 If padding is disabled then the input data must be a multiple of the cipher
323 block length.
324 .PP
325 All RC2 ciphers have the same key and effective key length.
326 .PP
327 Blowfish and RC5 algorithms use a 128 bit key.
328 .PP
329 Please note that OpenSSL 3.0 changed the effect of the \fB\-S\fR option.
330 Any explicit salt value specified via this option is no longer prepended to the
331 ciphertext when encrypting, and must again be explicitly provided when decrypting.
332 Conversely, when the \fB\-S\fR option is used during decryption, the ciphertext
333 is expected to not have a prepended salt value.
334 .PP
335 When using OpenSSL 3.0 or later to decrypt data that was encrypted with an
336 explicit salt under OpenSSL 1.1.1 do not use the \fB\-S\fR option, the salt will
337 then be read from the ciphertext.
338 To generate ciphertext that can be decrypted with OpenSSL 1.1.1 do not use
339 the \fB\-S\fR option, the salt will be then be generated randomly and prepended
340 to the output.
341 .SH "SUPPORTED CIPHERS"
342 .IX Header "SUPPORTED CIPHERS"
343 Note that some of these ciphers can be disabled at compile time
344 and some are available only if an appropriate engine is configured
345 in the configuration file. The output when invoking this command
346 with the \fB\-list\fR option (that is \f(CW\*(C`openssl enc \-list\*(C'\fR) is
347 a list of ciphers, supported by your version of OpenSSL, including
348 ones provided by configured engines.
349 .PP
350 This command does not support authenticated encryption modes
351 like CCM and GCM, and will not support such modes in the future.
352 This is due to having to begin streaming output (e.g., to standard output
353 when \fB\-out\fR is not used) before the authentication tag could be validated.
354 When this command is used in a pipeline, the receiving end will not be
355 able to roll back upon authentication failure. The AEAD modes currently in
356 common use also suffer from catastrophic failure of confidentiality and/or
357 integrity upon reuse of key/iv/nonce, and since \fBopenssl enc\fR places the
358 entire burden of key/iv/nonce management upon the user, the risk of
359 exposing AEAD modes is too great to allow. These key/iv/nonce
360 management issues also affect other modes currently exposed in this command,
361 but the failure modes are less extreme in these cases, and the
362 functionality cannot be removed with a stable release branch.
363 For bulk encryption of data, whether using authenticated encryption
364 modes or other modes, \fBopenssl\-cms\fR\|(1) is recommended, as it provides a
365 standard data format and performs the needed key/iv/nonce management.
366 .PP
367 When enc is used with key wrapping modes the input data cannot be streamed,
368 meaning it must be processed in a single pass.
369 Consequently, the input data size must be less than
370 the buffer size (\-bufsize arg, default to 8*1024 bytes).
371 The '*\-wrap' ciphers require the input to be a multiple of 8 bytes long,
372 because no padding is involved.
373 The '*\-wrap\-pad' ciphers allow any input length.
374 In both cases, no IV is needed. See example below.
375 .PP
376 .Vb 1
377 \& base64 Base 64
378 \&
379 \& bf\-cbc Blowfish in CBC mode
380 \& bf Alias for bf\-cbc
381 \& blowfish Alias for bf\-cbc
382 \& bf\-cfb Blowfish in CFB mode
383 \& bf\-ecb Blowfish in ECB mode
384 \& bf\-ofb Blowfish in OFB mode
385 \&
386 \& cast\-cbc CAST in CBC mode
387 \& cast Alias for cast\-cbc
388 \& cast5\-cbc CAST5 in CBC mode
389 \& cast5\-cfb CAST5 in CFB mode
390 \& cast5\-ecb CAST5 in ECB mode
391 \& cast5\-ofb CAST5 in OFB mode
392 \&
393 \& chacha20 ChaCha20 algorithm
394 \&
395 \& des\-cbc DES in CBC mode
396 \& des Alias for des\-cbc
397 \& des\-cfb DES in CFB mode
398 \& des\-ofb DES in OFB mode
399 \& des\-ecb DES in ECB mode
400 \&
401 \& des\-ede\-cbc Two key triple DES EDE in CBC mode
402 \& des\-ede Two key triple DES EDE in ECB mode
403 \& des\-ede\-cfb Two key triple DES EDE in CFB mode
404 \& des\-ede\-ofb Two key triple DES EDE in OFB mode
405 \&
406 \& des\-ede3\-cbc Three key triple DES EDE in CBC mode
407 \& des\-ede3 Three key triple DES EDE in ECB mode
408 \& des3 Alias for des\-ede3\-cbc
409 \& des\-ede3\-cfb Three key triple DES EDE CFB mode
410 \& des\-ede3\-ofb Three key triple DES EDE in OFB mode
411 \&
412 \& desx DESX algorithm.
413 \&
414 \& gost89 GOST 28147\-89 in CFB mode (provided by ccgost engine)
415 \& gost89\-cnt GOST 28147\-89 in CNT mode (provided by ccgost engine)
416 \&
417 \& idea\-cbc IDEA algorithm in CBC mode
418 \& idea same as idea\-cbc
419 \& idea\-cfb IDEA in CFB mode
420 \& idea\-ecb IDEA in ECB mode
421 \& idea\-ofb IDEA in OFB mode
422 \&
423 \& rc2\-cbc 128 bit RC2 in CBC mode
424 \& rc2 Alias for rc2\-cbc
425 \& rc2\-cfb 128 bit RC2 in CFB mode
426 \& rc2\-ecb 128 bit RC2 in ECB mode
427 \& rc2\-ofb 128 bit RC2 in OFB mode
428 \& rc2\-64\-cbc 64 bit RC2 in CBC mode
429 \& rc2\-40\-cbc 40 bit RC2 in CBC mode
430 \&
431 \& rc4 128 bit RC4
432 \& rc4\-64 64 bit RC4
433 \& rc4\-40 40 bit RC4
434 \&
435 \& rc5\-cbc RC5 cipher in CBC mode
436 \& rc5 Alias for rc5\-cbc
437 \& rc5\-cfb RC5 cipher in CFB mode
438 \& rc5\-ecb RC5 cipher in ECB mode
439 \& rc5\-ofb RC5 cipher in OFB mode
440 \&
441 \& seed\-cbc SEED cipher in CBC mode
442 \& seed Alias for seed\-cbc
443 \& seed\-cfb SEED cipher in CFB mode
444 \& seed\-ecb SEED cipher in ECB mode
445 \& seed\-ofb SEED cipher in OFB mode
446 \&
447 \& sm4\-cbc SM4 cipher in CBC mode
448 \& sm4 Alias for sm4\-cbc
449 \& sm4\-cfb SM4 cipher in CFB mode
450 \& sm4\-ctr SM4 cipher in CTR mode
451 \& sm4\-ecb SM4 cipher in ECB mode
452 \& sm4\-ofb SM4 cipher in OFB mode
453 \&
454 \& aes\-[128|192|256]\-cbc 128/192/256 bit AES in CBC mode
455 \& aes[128|192|256] Alias for aes\-[128|192|256]\-cbc
456 \& aes\-[128|192|256]\-cfb 128/192/256 bit AES in 128 bit CFB mode
457 \& aes\-[128|192|256]\-cfb1 128/192/256 bit AES in 1 bit CFB mode
458 \& aes\-[128|192|256]\-cfb8 128/192/256 bit AES in 8 bit CFB mode
459 \& aes\-[128|192|256]\-ctr 128/192/256 bit AES in CTR mode
460 \& aes\-[128|192|256]\-ecb 128/192/256 bit AES in ECB mode
461 \& aes\-[128|192|256]\-ofb 128/192/256 bit AES in OFB mode
462 \&
463 \& aes\-[128|192|256]\-wrap key wrapping using 128/192/256 bit AES
464 \& aes\-[128|192|256]\-wrap\-pad key wrapping with padding using 128/192/256 bit AES
465 \&
466 \& aria\-[128|192|256]\-cbc 128/192/256 bit ARIA in CBC mode
467 \& aria[128|192|256] Alias for aria\-[128|192|256]\-cbc
468 \& aria\-[128|192|256]\-cfb 128/192/256 bit ARIA in 128 bit CFB mode
469 \& aria\-[128|192|256]\-cfb1 128/192/256 bit ARIA in 1 bit CFB mode
470 \& aria\-[128|192|256]\-cfb8 128/192/256 bit ARIA in 8 bit CFB mode
471 \& aria\-[128|192|256]\-ctr 128/192/256 bit ARIA in CTR mode
472 \& aria\-[128|192|256]\-ecb 128/192/256 bit ARIA in ECB mode
473 \& aria\-[128|192|256]\-ofb 128/192/256 bit ARIA in OFB mode
474 \&
475 \& camellia\-[128|192|256]\-cbc 128/192/256 bit Camellia in CBC mode
476 \& camellia[128|192|256] Alias for camellia\-[128|192|256]\-cbc
477 \& camellia\-[128|192|256]\-cfb 128/192/256 bit Camellia in 128 bit CFB mode
478 \& camellia\-[128|192|256]\-cfb1 128/192/256 bit Camellia in 1 bit CFB mode
479 \& camellia\-[128|192|256]\-cfb8 128/192/256 bit Camellia in 8 bit CFB mode
480 \& camellia\-[128|192|256]\-ctr 128/192/256 bit Camellia in CTR mode
481 \& camellia\-[128|192|256]\-ecb 128/192/256 bit Camellia in ECB mode
482 \& camellia\-[128|192|256]\-ofb 128/192/256 bit Camellia in OFB mode
483 .Ve
484 .SH EXAMPLES
485 .IX Header "EXAMPLES"
486 Just base64 encode a binary file:
487 .PP
488 .Vb 1
489 \& openssl base64 \-in file.bin \-out file.b64
490 .Ve
491 .PP
492 Decode the same file
493 .PP
494 .Vb 1
495 \& openssl base64 \-d \-in file.b64 \-out file.bin
496 .Ve
497 .PP
498 Encrypt a file using AES\-128 using a prompted password
499 and PBKDF2 key derivation:
500 .PP
501 .Vb 1
502 \& openssl enc \-aes128 \-pbkdf2 \-in file.txt \-out file.aes128
503 .Ve
504 .PP
505 Decrypt a file using a supplied password:
506 .PP
507 .Vb 2
508 \& openssl enc \-aes128 \-pbkdf2 \-d \-in file.aes128 \-out file.txt \e
509 \& \-pass pass:<password>
510 .Ve
511 .PP
512 Encrypt a file then base64 encode it (so it can be sent via mail for example)
513 using AES\-256 in CTR mode and PBKDF2 key derivation:
514 .PP
515 .Vb 1
516 \& openssl enc \-aes\-256\-ctr \-pbkdf2 \-a \-in file.txt \-out file.aes256
517 .Ve
518 .PP
519 Base64 decode a file then decrypt it using a password supplied in a file:
520 .PP
521 .Vb 2
522 \& openssl enc \-aes\-256\-ctr \-pbkdf2 \-d \-a \-in file.aes256 \-out file.txt \e
523 \& \-pass file:<passfile>
524 .Ve
525 .PP
526 AES key wrapping:
527 .PP
528 .Vb 3
529 \& openssl enc \-e \-a \-id\-aes128\-wrap\-pad \-K 000102030405060708090A0B0C0D0E0F \-in file.bin
530 \&or
531 \& openssl aes128\-wrap\-pad \-e \-a \-K 000102030405060708090A0B0C0D0E0F \-in file.bin
532 .Ve
533 .SH BUGS
534 .IX Header "BUGS"
535 The \fB\-A\fR option when used with large files doesn't work properly.
536 On the other hand, when base64 decoding without the \fB\-A\fR option,
537 if the first 1024 bytes of input do not include a newline character
538 the first two lines of input are ignored.
539 .PP
540 The \fBopenssl enc\fR command only supports a fixed number of algorithms with
541 certain parameters. So if, for example, you want to use RC2 with a
542 76 bit key or RC4 with an 84 bit key you can't use this program.
543 .SH "SEE ALSO"
544 .IX Header "SEE ALSO"
545 \&\fBopenssl\-list\fR\|(1), \fBEVP_SKEY\fR\|(3)
546 .SH HISTORY
547 .IX Header "HISTORY"
548 The default digest was changed from MD5 to SHA256 in OpenSSL 1.1.0.
549 .PP
550 The \fB\-list\fR option was added in OpenSSL 1.1.1e.
551 .PP
552 The \fB\-ciphers\fR and \fB\-engine\fR options were deprecated in OpenSSL 3.0.
553 .PP
554 The \fB\-saltlen\fR option was added in OpenSSL 3.2.
555 .PP
556 The \fB\-skeymgmt\fR and \fB\-skeyopt\fR options were added in OpenSSL 3.5.
557 .SH COPYRIGHT
558 .IX Header "COPYRIGHT"
559 Copyright 2000\-2025 The OpenSSL Project Authors. All Rights Reserved.
560 .PP
561 Licensed under the Apache License 2.0 (the "License"). You may not use
562 this file except in compliance with the License. You can obtain a copy
563 in the file LICENSE in the source distribution or at
564 <https://www.openssl.org/source/license.html>.