openssl encrypt by specifying AES 256 key instead of passphrase
2
votes
1
answer
3799
views
I need to encrypt some data using aes-256-ecb since a backend code expects it as a configuration. I'm able to encrypt using a key which is derived from a passphrase using:
openssl enc -p -aes-256-ecb -nosalt -pbkdf2 -base64 -in data-plain.txt -out data-encrypted.txt | sed 's/key=//g'
This encrypts using derived key and outputs the key in console.
However, I couldn't find how to do it with a generated key, something like:
1. Generate a 256-bit key using:
openssl rand -base64 32 > key.data
2. Then use this key during encryption, with something like:
openssl enc -p -aes-256-ecb **-key=key.data** -nosalt -pbkdf2 -base64 -in data-plain.txt -out data-encrypted.txt
Is this possible?
Asked by isah
(123 rep)
Nov 2, 2022, 09:55 PM
Last activity: Nov 4, 2022, 12:25 AM
Last activity: Nov 4, 2022, 12:25 AM