December 2024
M T W T F S S
 1
2345678
9101112131415
16171819202122
23242526272829
3031  

Categories

December 2024
M T W T F S S
 1
2345678
9101112131415
16171819202122
23242526272829
3031  

Encrypt/Decrypt string with openssl

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

Leave a Reply

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>