Use RSA with OpenSSL on Mac
Generate RSA key:
$ openssl genrsa -out key.pem 1024
Save public key in pub.pem file:
$ openssl rsa -in key.pem -pubout -out pub.pem
Encrypt some data:
$ echo test test test > file.txt $ openssl rsautl -encrypt -inkey pub.pem -pubin -in file.txt -out file.bin
Decrypt encrypted data:
openssl rsautl -decrypt -inkey key.pem -in file.bin
Last updated 4 years ago