May 2025
M T W T F S S
 1234
567891011
12131415161718
19202122232425
262728293031  

Categories

May 2025
M T W T F S S
 1234
567891011
12131415161718
19202122232425
262728293031  

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>