If you quickly want to encrypt a file using the command line, you don't want to go all fancy with PGP and public keys and stuff. Your preinstalled openssl and a password is all you need.
Few people are aware of the fact that openssl can encrypt files, and fewer can memoize the right command line arguments. This is why I added these two zsh functions to my ~/.zshrc
:
encrypt () { openssl des3 -in $1 -out $1.encrypted }
decrypt () { FILENAME=$(echo $1|sed -e 's/\.encrypted$//g'); openssl des3 -d -in $1 -out $FILENAME }
Now encryption is just a matter of running encrypt secret.txt
. Decryption assumes the file has an .encrypted
suffix, so you run it like decrypt secret.txt.encrypted
. Finally, encryption as easy as pie! :)