Debian Codegraph @

upstream/debian-trixie/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.5.6 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[\fBk\fR]" 4
230 .IX Item "-bufsize number[k]"
231 Set the buffer size for I/O.
232 The maximum size that can be specified is \fB2^31\-1\fR (2147483647) bytes.
233 The \fBk\fR suffix can be specified to indicate that \fInumber\fR is provided
234 in kibibytes (multiples of 1024 bytes).
235 .IP \fB\-nopad\fR 4
236 .IX Item "-nopad"
237 Disable standard block padding.
238 .IP \fB\-v\fR 4
239 .IX Item "-v"
240 Verbose print; display some statistics about I/O and buffer sizes.
241 .IP \fB\-debug\fR 4
242 .IX Item "-debug"
243 Debug the BIOs used for I/O.
244 .IP \fB\-z\fR 4
245 .IX Item "-z"
246 Compress or decompress encrypted data using zlib after encryption or before
247 decryption. This option exists only if OpenSSL was compiled with the zlib
248 or zlib-dynamic option.
249 .IP \fB\-none\fR 4
250 .IX Item "-none"
251 Use NULL cipher (no encryption or decryption of input).
252 .IP "\fB\-skeymgmt\fR \fIskeymgmt\fR" 4
253 .IX Item "-skeymgmt skeymgmt"
254 Some providers may support opaque symmetric keys objects. To use them, we need
255 to know the name of the \fBEVP_SKEYMGMT\fR to be used. If not specified, the name
256 of the cipher will be used.
257 .Sp
258 To find out the name of the suitable symmetric key management,
259 please refer to the output of the \f(CW\*(C`openssl list \-skey\-managers\*(C'\fR command.
260 .IP "\fB\-skeyopt\fR \fIopt\fR:\fIvalue\fR" 4
261 .IX Item "-skeyopt opt:value"
262 To obtain an existing opaque symmetric key or generate a new one, key
263 options are specified as opt:value. These options can't be used together with
264 any options implying raw key directly or indirectly.
265 .IP "\fB\-rand\fR \fIfiles\fR, \fB\-writerand\fR \fIfile\fR" 4
266 .IX Item "-rand files, -writerand file"
267 See "Random State Options" in \fBopenssl\fR\|(1) for details.
268 .IP "\fB\-provider\fR \fIname\fR" 4
269 .IX Item "-provider name"
270 .PD 0
271 .IP "\fB\-provider\-path\fR \fIpath\fR" 4
272 .IX Item "-provider-path path"
273 .IP "\fB\-provparam\fR \fI[name:]key=value\fR" 4
274 .IX Item "-provparam [name:]key=value"
275 .IP "\fB\-propquery\fR \fIpropq\fR" 4
276 .IX Item "-propquery propq"
277 .PD
278 See "Provider Options" in \fBopenssl\fR\|(1), \fBprovider\fR\|(7), and \fBproperty\fR\|(7).
279 .IP "\fB\-engine\fR \fIid\fR" 4
280 .IX Item "-engine id"
281 See "Engine Options" in \fBopenssl\fR\|(1).
282 This option is deprecated.
283 .SH NOTES
284 .IX Header "NOTES"
285 The program can be called either as \f(CW\*(C`openssl \fR\f(CIcipher\fR\f(CW\*(C'\fR or
286 \&\f(CW\*(C`openssl enc \-\fR\f(CIcipher\fR\f(CW\*(C'\fR. The first form doesn't work with
287 engine-provided ciphers, because this form is processed before the
288 configuration file is read and any ENGINEs loaded.
289 Use the \fBopenssl\-list\fR\|(1) command to get a list of supported ciphers.
290 .PP
291 Engines which provide entirely new encryption algorithms (such as the ccgost
292 engine which provides gost89 algorithm) should be configured in the
293 configuration file. Engines specified on the command line using \fB\-engine\fR
294 option can only be used for hardware-assisted implementations of
295 ciphers which are supported by the OpenSSL core or another engine specified
296 in the configuration file.
297 .PP
298 When the enc command lists supported ciphers, ciphers provided by engines,
299 specified in the configuration files are listed too.
300 .PP
301 A password will be prompted for to derive the key and IV if necessary.
302 .PP
303 The \fB\-salt\fR option should \fBALWAYS\fR be used if the key is being derived
304 from a password unless you want compatibility with previous versions of
305 OpenSSL.
306 .PP
307 Without the \fB\-salt\fR option it is possible to perform efficient dictionary
308 attacks on the password and to attack stream cipher encrypted data. The reason
309 for this is that without the salt the same password always generates the same
310 encryption key.
311 .PP
312 When the salt is generated at random (that means when encrypting using a
313 passphrase without explicit salt given using \fB\-S\fR option), the first bytes
314 of the encrypted data are reserved to store the salt for later decrypting.
315 .PP
316 Some of the ciphers do not have large keys and others have security
317 implications if not used correctly. A beginner is advised to just use
318 a strong block cipher, such as AES, in CBC mode.
319 .PP
320 All the block ciphers normally use PKCS#7 padding, also known as standard
321 block padding. This allows a rudimentary integrity or password check to
322 be performed. However, since the chance of random data passing the test
323 is better than 1 in 256 it isn't a very good test.
324 .PP
325 If padding is disabled then the input data must be a multiple of the cipher
326 block length.
327 .PP
328 All RC2 ciphers have the same key and effective key length.
329 .PP
330 Blowfish and RC5 algorithms use a 128 bit key.
331 .PP
332 Please note that OpenSSL 3.0 changed the effect of the \fB\-S\fR option.
333 Any explicit salt value specified via this option is no longer prepended to the
334 ciphertext when encrypting, and must again be explicitly provided when decrypting.
335 Conversely, when the \fB\-S\fR option is used during decryption, the ciphertext
336 is expected to not have a prepended salt value.
337 .PP
338 When using OpenSSL 3.0 or later to decrypt data that was encrypted with an
339 explicit salt under OpenSSL 1.1.1 do not use the \fB\-S\fR option, the salt will
340 then be read from the ciphertext.
341 To generate ciphertext that can be decrypted with OpenSSL 1.1.1 do not use
342 the \fB\-S\fR option, the salt will be then be generated randomly and prepended
343 to the output.
344 .SH "SUPPORTED CIPHERS"
345 .IX Header "SUPPORTED CIPHERS"
346 Note that some of these ciphers can be disabled at compile time
347 and some are available only if an appropriate engine is configured
348 in the configuration file. The output when invoking this command
349 with the \fB\-list\fR option (that is \f(CW\*(C`openssl enc \-list\*(C'\fR) is
350 a list of ciphers, supported by your version of OpenSSL, including
351 ones provided by configured engines.
352 .PP
353 This command does not support authenticated encryption modes
354 like CCM and GCM, and will not support such modes in the future.
355 This is due to having to begin streaming output (e.g., to standard output
356 when \fB\-out\fR is not used) before the authentication tag could be validated.
357 When this command is used in a pipeline, the receiving end will not be
358 able to roll back upon authentication failure. The AEAD modes currently in
359 common use also suffer from catastrophic failure of confidentiality and/or
360 integrity upon reuse of key/iv/nonce, and since \fBopenssl enc\fR places the
361 entire burden of key/iv/nonce management upon the user, the risk of
362 exposing AEAD modes is too great to allow. These key/iv/nonce
363 management issues also affect other modes currently exposed in this command,
364 but the failure modes are less extreme in these cases, and the
365 functionality cannot be removed with a stable release branch.
366 For bulk encryption of data, whether using authenticated encryption
367 modes or other modes, \fBopenssl\-cms\fR\|(1) is recommended, as it provides a
368 standard data format and performs the needed key/iv/nonce management.
369 .PP
370 When enc is used with key wrapping modes the input data cannot be streamed,
371 meaning it must be processed in a single pass.
372 Consequently, the input data size must be less than
373 the buffer size (\-bufsize arg, default to 8*1024 bytes).
374 The '*\-wrap' ciphers require the input to be a multiple of 8 bytes long,
375 because no padding is involved.
376 The '*\-wrap\-pad' ciphers allow any input length.
377 In both cases, no IV is needed. See example below.
378 .PP
379 .Vb 1
380 \& base64 Base 64
381 \&
382 \& bf\-cbc Blowfish in CBC mode
383 \& bf Alias for bf\-cbc
384 \& blowfish Alias for bf\-cbc
385 \& bf\-cfb Blowfish in CFB mode
386 \& bf\-ecb Blowfish in ECB mode
387 \& bf\-ofb Blowfish in OFB mode
388 \&
389 \& cast\-cbc CAST in CBC mode
390 \& cast Alias for cast\-cbc
391 \& cast5\-cbc CAST5 in CBC mode
392 \& cast5\-cfb CAST5 in CFB mode
393 \& cast5\-ecb CAST5 in ECB mode
394 \& cast5\-ofb CAST5 in OFB mode
395 \&
396 \& chacha20 ChaCha20 algorithm
397 \&
398 \& des\-cbc DES in CBC mode
399 \& des Alias for des\-cbc
400 \& des\-cfb DES in CFB mode
401 \& des\-ofb DES in OFB mode
402 \& des\-ecb DES in ECB mode
403 \&
404 \& des\-ede\-cbc Two key triple DES EDE in CBC mode
405 \& des\-ede Two key triple DES EDE in ECB mode
406 \& des\-ede\-cfb Two key triple DES EDE in CFB mode
407 \& des\-ede\-ofb Two key triple DES EDE in OFB mode
408 \&
409 \& des\-ede3\-cbc Three key triple DES EDE in CBC mode
410 \& des\-ede3 Three key triple DES EDE in ECB mode
411 \& des3 Alias for des\-ede3\-cbc
412 \& des\-ede3\-cfb Three key triple DES EDE CFB mode
413 \& des\-ede3\-ofb Three key triple DES EDE in OFB mode
414 \&
415 \& desx DESX algorithm.
416 \&
417 \& gost89 GOST 28147\-89 in CFB mode (provided by ccgost engine)
418 \& gost89\-cnt GOST 28147\-89 in CNT mode (provided by ccgost engine)
419 \&
420 \& idea\-cbc IDEA algorithm in CBC mode
421 \& idea same as idea\-cbc
422 \& idea\-cfb IDEA in CFB mode
423 \& idea\-ecb IDEA in ECB mode
424 \& idea\-ofb IDEA in OFB mode
425 \&
426 \& rc2\-cbc 128 bit RC2 in CBC mode
427 \& rc2 Alias for rc2\-cbc
428 \& rc2\-cfb 128 bit RC2 in CFB mode
429 \& rc2\-ecb 128 bit RC2 in ECB mode
430 \& rc2\-ofb 128 bit RC2 in OFB mode
431 \& rc2\-64\-cbc 64 bit RC2 in CBC mode
432 \& rc2\-40\-cbc 40 bit RC2 in CBC mode
433 \&
434 \& rc4 128 bit RC4
435 \& rc4\-64 64 bit RC4
436 \& rc4\-40 40 bit RC4
437 \&
438 \& rc5\-cbc RC5 cipher in CBC mode
439 \& rc5 Alias for rc5\-cbc
440 \& rc5\-cfb RC5 cipher in CFB mode
441 \& rc5\-ecb RC5 cipher in ECB mode
442 \& rc5\-ofb RC5 cipher in OFB mode
443 \&
444 \& seed\-cbc SEED cipher in CBC mode
445 \& seed Alias for seed\-cbc
446 \& seed\-cfb SEED cipher in CFB mode
447 \& seed\-ecb SEED cipher in ECB mode
448 \& seed\-ofb SEED cipher in OFB mode
449 \&
450 \& sm4\-cbc SM4 cipher in CBC mode
451 \& sm4 Alias for sm4\-cbc
452 \& sm4\-cfb SM4 cipher in CFB mode
453 \& sm4\-ctr SM4 cipher in CTR mode
454 \& sm4\-ecb SM4 cipher in ECB mode
455 \& sm4\-ofb SM4 cipher in OFB mode
456 \&
457 \& aes\-[128|192|256]\-cbc 128/192/256 bit AES in CBC mode
458 \& aes[128|192|256] Alias for aes\-[128|192|256]\-cbc
459 \& aes\-[128|192|256]\-cfb 128/192/256 bit AES in 128 bit CFB mode
460 \& aes\-[128|192|256]\-cfb1 128/192/256 bit AES in 1 bit CFB mode
461 \& aes\-[128|192|256]\-cfb8 128/192/256 bit AES in 8 bit CFB mode
462 \& aes\-[128|192|256]\-ctr 128/192/256 bit AES in CTR mode
463 \& aes\-[128|192|256]\-ecb 128/192/256 bit AES in ECB mode
464 \& aes\-[128|192|256]\-ofb 128/192/256 bit AES in OFB mode
465 \&
466 \& aes\-[128|192|256]\-wrap key wrapping using 128/192/256 bit AES
467 \& aes\-[128|192|256]\-wrap\-pad key wrapping with padding using 128/192/256 bit AES
468 \&
469 \& aria\-[128|192|256]\-cbc 128/192/256 bit ARIA in CBC mode
470 \& aria[128|192|256] Alias for aria\-[128|192|256]\-cbc
471 \& aria\-[128|192|256]\-cfb 128/192/256 bit ARIA in 128 bit CFB mode
472 \& aria\-[128|192|256]\-cfb1 128/192/256 bit ARIA in 1 bit CFB mode
473 \& aria\-[128|192|256]\-cfb8 128/192/256 bit ARIA in 8 bit CFB mode
474 \& aria\-[128|192|256]\-ctr 128/192/256 bit ARIA in CTR mode
475 \& aria\-[128|192|256]\-ecb 128/192/256 bit ARIA in ECB mode
476 \& aria\-[128|192|256]\-ofb 128/192/256 bit ARIA in OFB mode
477 \&
478 \& camellia\-[128|192|256]\-cbc 128/192/256 bit Camellia in CBC mode
479 \& camellia[128|192|256] Alias for camellia\-[128|192|256]\-cbc
480 \& camellia\-[128|192|256]\-cfb 128/192/256 bit Camellia in 128 bit CFB mode
481 \& camellia\-[128|192|256]\-cfb1 128/192/256 bit Camellia in 1 bit CFB mode
482 \& camellia\-[128|192|256]\-cfb8 128/192/256 bit Camellia in 8 bit CFB mode
483 \& camellia\-[128|192|256]\-ctr 128/192/256 bit Camellia in CTR mode
484 \& camellia\-[128|192|256]\-ecb 128/192/256 bit Camellia in ECB mode
485 \& camellia\-[128|192|256]\-ofb 128/192/256 bit Camellia in OFB mode
486 .Ve
487 .SH EXAMPLES
488 .IX Header "EXAMPLES"
489 Just base64 encode a binary file:
490 .PP
491 .Vb 1
492 \& openssl base64 \-in file.bin \-out file.b64
493 .Ve
494 .PP
495 Decode the same file
496 .PP
497 .Vb 1
498 \& openssl base64 \-d \-in file.b64 \-out file.bin
499 .Ve
500 .PP
501 Encrypt a file using AES\-128 using a prompted password
502 and PBKDF2 key derivation:
503 .PP
504 .Vb 1
505 \& openssl enc \-aes128 \-pbkdf2 \-in file.txt \-out file.aes128
506 .Ve
507 .PP
508 Decrypt a file using a supplied password:
509 .PP
510 .Vb 2
511 \& openssl enc \-aes128 \-pbkdf2 \-d \-in file.aes128 \-out file.txt \e
512 \& \-pass pass:<password>
513 .Ve
514 .PP
515 Encrypt a file then base64 encode it (so it can be sent via mail for example)
516 using AES\-256 in CTR mode and PBKDF2 key derivation:
517 .PP
518 .Vb 1
519 \& openssl enc \-aes\-256\-ctr \-pbkdf2 \-a \-in file.txt \-out file.aes256
520 .Ve
521 .PP
522 Base64 decode a file then decrypt it using a password supplied in a file:
523 .PP
524 .Vb 2
525 \& openssl enc \-aes\-256\-ctr \-pbkdf2 \-d \-a \-in file.aes256 \-out file.txt \e
526 \& \-pass file:<passfile>
527 .Ve
528 .PP
529 AES key wrapping:
530 .PP
531 .Vb 3
532 \& openssl enc \-e \-a \-id\-aes128\-wrap\-pad \-K 000102030405060708090A0B0C0D0E0F \-in file.bin
533 \&or
534 \& openssl aes128\-wrap\-pad \-e \-a \-K 000102030405060708090A0B0C0D0E0F \-in file.bin
535 .Ve
536 .SH BUGS
537 .IX Header "BUGS"
538 The \fB\-A\fR option when used with large files doesn't work properly.
539 On the other hand, when base64 decoding without the \fB\-A\fR option,
540 if the first 1024 bytes of input do not include a newline character
541 the first two lines of input are ignored.
542 .PP
543 The \fBopenssl enc\fR command only supports a fixed number of algorithms with
544 certain parameters. So if, for example, you want to use RC2 with a
545 76 bit key or RC4 with an 84 bit key you can't use this program.
546 .SH "SEE ALSO"
547 .IX Header "SEE ALSO"
548 \&\fBopenssl\-list\fR\|(1), \fBEVP_SKEY\fR\|(3)
549 .SH HISTORY
550 .IX Header "HISTORY"
551 The default digest was changed from MD5 to SHA256 in OpenSSL 1.1.0.
552 .PP
553 The \fB\-list\fR option was added in OpenSSL 1.1.1e.
554 .PP
555 The \fB\-ciphers\fR and \fB\-engine\fR options were deprecated in OpenSSL 3.0.
556 .PP
557 The \fB\-saltlen\fR option was added in OpenSSL 3.2.
558 .PP
559 The \fB\-skeymgmt\fR and \fB\-skeyopt\fR options were added in OpenSSL 3.5.
560 .SH COPYRIGHT
561 .IX Header "COPYRIGHT"
562 Copyright 2000\-2025 The OpenSSL Project Authors. All Rights Reserved.
563 .PP
564 Licensed under the Apache License 2.0 (the "License"). You may not use
565 this file except in compliance with the License. You can obtain a copy
566 in the file LICENSE in the source distribution or at
567 <https://www.openssl.org/source/license.html>.