April 2024
M T W T F S S
1234567
891011121314
15161718192021
22232425262728
2930  

Categories

April 2024
M T W T F S S
1234567
891011121314
15161718192021
22232425262728
2930  

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>