How to encrypt and decrypt a text file using openssl rsa public and private keys
openssl rsautl -encrypt -pubin -inkey public_key.pem -in secret.txt -out secret.enc
#where "secret.txt" is the original file and "secret.enc" is the encrypted file.
# To decrypt
openssl rsautl -decrypt -inkey private_key.pem -in secret.enc