How to encrypt a message or file using Openssl With openssl, it’s not too hard. The following tutorial assumes you’ve setup RSA private/publicc.
Note: If you’re on OSX, you should install the latest versions of OpenSSL and OpenSSH with Homebrew.
First, let’s start with our plaintext file:
# echo "Hello world" > test.txt Encrypt with Public key # cat test.txt | openssl rsautl -encrypt -pubin -inkey ~/.