Skip to content

Instantly share code, notes, and snippets.

@jonnyparris
Created May 2, 2020 22:38
Show Gist options
  • Save jonnyparris/7eb25a4c1fcad7a111490c988f914677 to your computer and use it in GitHub Desktop.
Save jonnyparris/7eb25a4c1fcad7a111490c988f914677 to your computer and use it in GitHub Desktop.
Basica file encryption and decryption with openssl via the commandline
# encrypt file.txt to file.enc using 256-bit AES in CBC mode
openssl enc -aes-256-cbc -salt -in file.txt -out file.enc
# the same, only the output is base64 encoded for, e.g., e-mail
openssl enc -aes-256-cbc -a -salt -in file.txt -out file.enc
# To decrypt file.enc you or the file’s recipient will need to remember the cipher and the passphrase.
# decrypt binary file.enc
openssl enc -d -aes-256-cbc -in file.enc
# decrypt base64-encoded version
openssl enc -d -aes-256-cbc -a -in file.enc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment