Skip to content

Instantly share code, notes, and snippets.

@robhurring
Created November 22, 2010 19:48
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save robhurring/710537 to your computer and use it in GitHub Desktop.
Save robhurring/710537 to your computer and use it in GitHub Desktop.
Fun with OpenSSL encryption
# Put this somehwere in .bashrc/aliases/etc.
# OpenSSL must be installed -- these are just aliases.
alias enc='openssl enc -e -aes-256-cbc -salt '
alias dec='openssl enc -d -aes-256-cbc '
# encrypted gzipped db dump
mysqldump -uroot DBNAME|enc|gzip -c>db.sql.enc.gz
# decrypted gzipped db dump
gunzip -dc db.sql.enc.gz|dec>db.sql
# decrypted gzipped db dump to import -- sneaky sneaky o_O
gunzip -dc db.sql.enc.gz|dec|mysql -uroot DBNAME
# encrypted tarball
tar czf - blah/|enc > blah.tar.gz.enc
# decrypt encrypted tarball
dec < blah.tar.gz.enc|tar xzf -
# fun with passwords!
enc < passwords.txt > passwords.txt.enc
dec < passwords.txt.enc > passwords.txt
# ... and so on and so forth ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment