Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.