Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.debian.user > #227867 > unrolled thread
| Started by | Philipp Ewald <philipp.ewald@digionline.de> |
|---|---|
| First post | 2020-10-16 16:00 +0200 |
| Last post | 2020-10-16 22:40 +0200 |
| Articles | 5 — 3 participants |
Back to article view | Back to linux.debian.user
OpenSSl encrpt and decrypt a String Philipp Ewald <philipp.ewald@digionline.de> - 2020-10-16 16:00 +0200
Re: OpenSSl encrpt and decrypt a String Reco <recoverym4n@enotuniq.net> - 2020-10-16 18:20 +0200
Re: OpenSSl encrpt and decrypt a String Philipp Ewald <philipp.ewald@digionline.de> - 2020-10-16 18:30 +0200
Re: OpenSSl encrpt and decrypt a String Reco <recoverym4n@enotuniq.net> - 2020-10-16 19:40 +0200
Re: OpenSSl encrpt and decrypt a String l0f4r0@tuta.io - 2020-10-16 22:40 +0200
| From | Philipp Ewald <philipp.ewald@digionline.de> |
|---|---|
| Date | 2020-10-16 16:00 +0200 |
| Subject | OpenSSl encrpt and decrypt a String |
| Message-ID | <B0yr0-60c-3@gated-at.bofh.it> |
Hey everyone, i try to encrypt a String with OpenSSL but its not working as i want. echo -n "That's the text" | openssl enc -aes-256-cbc -a -A -nosalt gives me following "String": ttn39k7YiglePLvmmc6s+w== echo -n "ttn39k7YiglePLvmmc6s+w==" | openssl base64 -d | openssl enc -d -aes-256-cbc echo -n "ttn39k7YiglePLvmmc6s+w==" | openssl base64 -d | openssl enc -d -aes-256-cbc -nosalt is not working "bad decrypt" or "bad magic number" can some one explain why this isn't working? and how it should work? Kind regards Philipp -- Philipp Ewald Administrator DigiOnline GmbH, Probsteigasse 15 - 19, 50670 Köln AG Köln HRB 27711, St.-Nr. 5215 5811 0640 Informationen zum Datenschutz: www.digionline.de/ds
[toc] | [next] | [standalone]
| From | Reco <recoverym4n@enotuniq.net> |
|---|---|
| Date | 2020-10-16 18:20 +0200 |
| Message-ID | <B0ACu-7u9-5@gated-at.bofh.it> |
| In reply to | #227867 |
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
[toc] | [prev] | [next] | [standalone]
| From | Philipp Ewald <philipp.ewald@digionline.de> |
|---|---|
| Date | 2020-10-16 18:30 +0200 |
| Message-ID | <B0AM9-7xh-7@gated-at.bofh.it> |
| In reply to | #227875 |
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
[toc] | [prev] | [next] | [standalone]
| From | Reco <recoverym4n@enotuniq.net> |
|---|---|
| Date | 2020-10-16 19:40 +0200 |
| Message-ID | <B0BRU-8ae-15@gated-at.bofh.it> |
| In reply to | #227876 |
On Fri, Oct 16, 2020 at 06:24:31PM +0200, Philipp Ewald wrote: > Thank you! > > I have used this : openssl base64 -d instead of "base64 -d" ...... You're welcome. Reco
[toc] | [prev] | [next] | [standalone]
| From | l0f4r0@tuta.io |
|---|---|
| Date | 2020-10-16 22:40 +0200 |
| Message-ID | <B0EG5-1py-7@gated-at.bofh.it> |
| In reply to | #227867 |
Hi, 16 oct. 2020 à 15:58 de philipp.ewald@digionline.de: > i try to encrypt a String with OpenSSL but its not working as i want. > > echo -n "That's the text" | openssl enc -aes-256-cbc -a -A -nosalt > I don't know if your question is just theoretical or if you have a valid use case beyond the base64 "issue", but please note that CBC mode is probably not what you want if you are looking for security (see padding oracle attacks). Some pointers: * https://en.wikipedia.org/wiki/Block_cipher_mode_of_operation * https://blog.cloudflare.com/padding-oracles-and-the-decline-of-cbc-mode-ciphersuites/ * https://robertheaton.com/2013/07/29/padding-oracle-attack/ Best regards, l0f4r0
[toc] | [prev] | [standalone]
Back to top | Article view | linux.debian.user
csiph-web