Sometimes it can be helpfull to encrypt/decrypt strings on Linux.
Of course we can install tools like crypt but is not always available after default installation.
Good thing is that we also have openssl which is nearly always installed on a linux server.
How to encrypt a string with openssl :
$ echo “juicy” | openssl aes-256-cbc -a -salt
enter aes-256-cbc encryption password:
Verifying – enter aes-256-cbc encryption password:
U2FsdGVkX1+0ouL4Ewo0SDicF69rjllKwpKWtGfm9wI=
So how do we decrypt this string ?
$ echo “U2FsdGVkX1+0ouL4Ewo0SDicF69rjllKwpKWtGfm9wI=” | openssl aes-256-cbc -a -d -salt
enter aes-256-cbc decryption password:
juicy
Recent Comments