[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: OpenSSl encrpt and decrypt a String



Thank you!

I have used this : openssl base64 -d instead of "base64 -d" ......

On 16.10.20 18:09, Reco wrote:
	Hi.

On Fri, Oct 16, 2020 at 03:58:46PM +0200, Philipp Ewald wrote:
echo -n "That's the text" | openssl enc -aes-256-cbc -a -A -nosalt

gives me following "String":
ttn39k7YiglePLvmmc6s+w==

Correct so far, assuming that you've entered a passphrase from the
keyboard.


echo -n "ttn39k7YiglePLvmmc6s+w==" | openssl base64 -d | openssl enc -d -aes-256-cbc

Wrong one. By default openssl assumes that plaintext is salted before
the encryption.


echo -n "ttn39k7YiglePLvmmc6s+w==" | openssl base64 -d | openssl enc -d -aes-256-cbc -nosalt

That one worked for me, but I've used a different passphrase, so the
ciphertext was different:

$ echo -n "That's the text" | openssl enc -aes-256-cbc -a -A -nosalt -k foo 2>/dev/null
3zGGAzM31Vsu9cax67TUrw==
$ echo -n 3zGGAzM31Vsu9cax67TUrw== | base64 -d | openssl enc  -d -aes-256-cbc -nosalt -k foo 2>/dev/null
That's the text
$ openssl version
OpenSSL 1.1.1d  10 Sep 2019

Reco


--
Philipp Ewald
Administrator

DigiOnline GmbH, Probsteigasse 15 - 19, 50670 Köln
Telefon: +49 221 6500-532, Fax: +49 221 6500-690, E-Mail: philipp.ewald@digionline.de

AG Köln HRB 27711, St.-Nr. 5215 5811 0640
Geschäftsführer: Werner Grafenhain

Informationen zum Datenschutz: www.digionline.de/ds


Reply to: