Wednesday, January 10, 2018

Encrypting stuff with Openssl

Let's first encode base64 the password:

echo -n "pippo" | openssl enc -base64

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

This is equivalent to

echo -n "pippo" | base64

You can then decode with "base64 -decode" :

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

or with "openssl enc -base64 -d":

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

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

You can always check here

No comments: