To encrypt messages using OpenSSL with RSA, you'll need the public key which can be found on this Website. Here's a basic guide:
This can also be done online but is insecure. https://www.cryptool.org/en/cto/openssl/
-
Generate a key pair: If you don't already have a key pair, you can generate one with OpenSSL.
-
openssl genrsa -out private_key.pem 4096
-
openssl rsa -pubout -in private_key.pem -out public_key.pem
-
Keep the private key safe. Send me only your public key.
-
Encrypt a message: Let's say your message is in a file named
message.txt
. -
openssl pkeyutl -encrypt -pubin -inkey public_key_of_myself.pem -in message_you_want_to_send_me.txt -out encrypted_message.dat
-
My public key can be found here: Public key
-
Decrypt the message: You, who has the private key of your keypair, can decrypt the message.
-
openssl pkeyutl -decrypt -inkey private_key_of_yourself_compatible_with_the_public_key_you_send_me.pem -in encrypted_message_which_i_send_you.dat -out decrypted_message.txt