At work, I wanted a way to encrypt some strings fairly easily and without any special tools. OpenSSL is everywhere, so I used that.
To encrypt a string using OpenSSL:
% echo 'foo' | openssl aes-256-cbc -a -salt enter aes-256-cbc encryption password: [passphrase hidden] Verifying - enter aes-256-cbc encryption password: [passphrase hidden] U2FsdGVkX1/QGdl4syQE8bLFSr2HzoAlcG299U/T/Xk=
To decrypt the result:
% echo 'U2FsdGVkX1/QGdl4syQE8bLFSr2HzoAlcG299U/T/Xk=' | openssl aes-256-cbc -a -d -salt enter aes-256-cbc decryption password: [passphrase hidden] foo
Of course, you don't have to use
openssl list-cipher-commands to see all of the available options.