Skip to content

Instantly share code, notes, and snippets.

@bradoyler
Last active February 10, 2018 22:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bradoyler/4173de2474cff13e5c53833e647ef192 to your computer and use it in GitHub Desktop.
Save bradoyler/4173de2474cff13e5c53833e647ef192 to your computer and use it in GitHub Desktop.
Easily encrypt/decrypt files with a given password (using OpenSSL AES-256 algorithm)

AES 256 Encryption scripts using OpenSSL (available on Linux/Mac)

Encrypt file:

sh encryptFile.sh my_secrets.txt

(you will be prompted for a password, make it STRONG)

output file will be: my_secrets.txt.enc

Decrypt & ONLY show in terminal:

sh decrypt.sh my_secrets.txt.enc

Decrypt to file:

sh decrypt.sh my_secrets.txt.enc > mySecrets2.txt
#!/usr/bin/env bash
openssl aes-256-cbc -salt -a -d -in $1
#!/usr/bin/env bash
openssl aes-256-cbc -salt -a -e -in $1 -out $1.enc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment