Create private key
openssl genrsa -out key.pem 2048
Create public key
openssl rsa -in key.pem -out key-public.pem -outform PEM -pubout
Save password to File
echo -n "enter_your_password" > key.txt
Encrypt file with passphase
openssl enc -aes-256-cbc -pass file:key.txt < UNENCRYPTED_FILE > encrypted.dat
Encrypt passphrase with public key
openssl rsautl -encrypt -pubin -inkey key-public.pem < key.txt > enc.key.txt
Decrypt encrypted passphrase with private key
openssl rsautl -decrypt -inkey key.pem < enc.key.txt > key.txt
Decrypt file
openssl enc -aes-256-cbc -d -pass file:key.txt < encrypted.dat > UNENCRYPTED_FILE