$ tar cz folder_to_encrypt | openssl enc -aes-256-cbc -e > out.tar.gz.enc
or
$ gpg --encrypt out.tar.gz
the “gpg -c” command by default does compression before encryption or use 7z
Generating GPG Keys
$ gpg --gen-key $ gpg --export --armor Zee $ gpg --export-secret-keys --armor Zee $ gpg --export --armor Zee
Decrypt
$ gpg --output ./backup.sql --decrypt ./backup.sql.gpg
References
- http://superuser.com/questions/162624/how-to-password-protect-gzip-files-on-the-command-line
- http://www.madboa.com/geek/gpg-quickstart/
TAR with GPG Encryption