Wednesday, January 10, 2018

Encrypting stuff with Openssl

Let's first encode base64 the password:

echo -n "pippo" | openssl enc -base64
cGlwcG8=


man echo says: "-n do not output the trailing newline"


This is equivalent to

echo -n "pippo" | base64
cGlwcG8=

You can then decode with "base64 -decode" :

echo -n "pippo" | base64 | base64 --decode
pippo


or with "openssl enc -base64 -d":

echo -n "pippo" | openssl enc -base64 | openssl enc -base64 -d
pippo


If you want to encrypt with a salt:

openssl aes-256-cbc -in mypw.txt -out mypwenc.txt -e -pass pass:pluto

and to decrypt:

openssl aes-256-cbc -in mypwenc.txt -out mypwclear.txt -d -pass pass:pluto

Details on the openssl command options are here https://wiki.openssl.org/index.php/Manual:Openssl(1)


You can always check here https://encode-decode.com/aes-256-ofb-encrypt-online/



No comments: