# Generating keys and encrypt/decrypt files using OpenSSL PRIVATE_KEY=private1.pem PUBLIC_KEY=public1.pem PLAIN_TEXT=secrets.txt ENCRY_TEXT=${PLAIN_TEXT}.enc PLAIN_TEXT1=secrets1.txt # # Generate Private and Public Keys openssl genrsa -out $PRIVATE_KEY 8192 openssl rsa -in $PRIVATE_KEY -outform PEM -pubout -out $PUBLIC_KEY # Encrypt openssl rsautl -encrypt -in $PLAIN_TEXT -out $ENCRY_TEXT -pubin -inkey $PUBLIC_KEY # Decrypt openssl rsautl -decrypt -in $ENCRY_TEXT -out $PLAIN_TEXT1 -inkey $PRIVATE_KEY # Verify diff $PLAIN_TEXT $PLAIN_TEXT1