OpenSSL: Password Encryption

Generate password file

This will generate 64 bytes file with random bytes.

openssl rand -out passwd.txt 64
openssl rand -hex -out passwd.txt 64
openssl rand -base64 -out passwd.txt 64

Encrypt using password file

echo 'hello' > hello.txt
openssl enc -aes-256-cbc -pbkdf2 -salt -in hello.txt -out hello.txt.enc -pass file:./passwd.txt

Decrypt using password file

openssl enc -d -aes-256-cbc -pbkdf2 -salt -in hello.txt.enc -out hello.txt.org -pass file:./passwd.txt

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *