Encrypt Files

A single file

Encrypt and decrypt:

openssl aes-256-cbc -salt -in file -out file.aes
openssl aes-256-cbc -d -salt -in file.aes -out file

Note that the file can of course be a tar archive.

tar and encrypt a whole directory

tar -cf - directory | openssl aes-256-cbc -salt -out directory.tar.aes
openssl aes-256-cbc -d -salt -in directory.tar.aes | tar -x -f -

tar zip and encrypt a whole directory

tar -zcf - directory | openssl aes-256-cbc -salt -out directory.tar.gz.aes
openssl aes-256-cbc -d -salt -in directory.tar.gz.aes | tar -xz -f -

Password from file option

-pass file:<passwdfile>

zdroj: http://sleepyhead.de/howto/?href=crypt/