How to not only encrypt but also decrypt a (password) string
Towards the end (points 4. and 5.) this article has instructions on how to encrypt/decrypt any string.
It might come in handy when e.g. checking your Email with curl, because one wouldn't want the password in plain text either on the command line or in some file.
Here's a slightly refined version:
openssl enc -aes-256-cbc -iter 99999 -a -pass env:USER -out some_file
Now enter username:password
(or whatever string you want to encode), press Enter, then Ctrl-D.
In addition to aes-256-cbc encryption with a random salt, it also uses a passphrase - in this case the content of the environment variable USER. There's a few more options, please read man openssl
under OPTIONS.
The file some_file
is created.
One can add comments (starting with #
) inside the file, very handy!
The file needs to be decoded with the same parameters:
openssl enc -aes-256-cbc -iter 99999 -a -pass env:USER -d -in some_file