Last Updated: February 25, 2016
·
799
· Gabriel Falcão

AES-256 CBC encryption for fun and profit

Generating a new encryption key

openssl rand -base64 512 | tr -d '\r\n' > ./key-dir/production-secret-key.aes256

Encrypting a file

openssl aes-256-cbc -a -salt -in production.tar.bz2 -out production.tar.aes256 -pass file:./key-dir/production-secret-key.aes256

Decrypting a file

openssl aes-256-cbc -d -a -salt -in production.tar.aes256 -out production.tar.bz2 -pass file:./key-dir/production-secret-key.aes256