Name
encrypt
Synopsis
encrypt [options
] [-iinfile
] [-ooutfile
]
Encrypt files using a PKCS#11 algorithm. Files are decrypted with decrypt. encrypt and decrypt are hard links to each other and accept the same options. Both programs read and write standard input and standard output by default. See also decrypt, digest, and mac.
Tip
These programs are not related to the original Unix crypt command. That program’s encryption algorithm is considered weak by today’s standards, and it should not be used.
Options
-
-a
algorithm
Use algorithm to encrypt the file. Possible values for algorithm are
aes
,arcfour
,des
, and3des
.-
-i
file
Read input data from file, instead of from standard input.
-
-k
keyfile
Read the encryption/decryption key from keyfile, instead of prompting for it.
-
-l
List available encryption algorithms. This option should be used by itself.
-
-o
file
Write output data to file, instead of to standard output.
-
-v
Be verbose. This prints a progress bar.
Examples
Display available algorithms:
$ encrypt -l
Algorithm Keysize: Min Max (bits)
------------------------------------------
aes 128 128
arcfour 8 128
des 64 64
3des 192 192
Encrypt a trade secret document, then decrypt it and compare the result to the original:
$encrypt -a aes -i designdoc.txt -o designdoc.txt.aes
Encrypt Enter key: Key is not echoed $file design*
Check results designdoc.txt: ASCII text designdoc.txt.aes: data $decrypt -a aes -i designdoc.txt.aes -o designdoc.txt.out
Decrypt Enter key: Enter same key $cmp designdoc.txt ...
Get Unix in a Nutshell, 4th Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.