In application, the common usage of RSA public key/private key pair are: signing, verify, encryption and decryption. In this short video, it has demonstrated how to used RSA public key/private key to perform encryption and decryption.
The example used in this video is:
Text Book RSA Key pair Example: Bob plan to send secret message to Alice;
1) Alice send her public key to bob, and keep private key to herself
2) Bon encrypted message using Alice's public key and send encrypted message to Alice
3) Alice received encrypted message and decrypted hash message using private key
4) after decryption, Alice is able to print/read decrypted message (in text)
The example of this video can also be performed through OpenSSL command line.
openssl rsautl -encrypt -inkey public_key.pem -pubin -in original_message.txt -out encrypt_message.dat
openssl rsautl -decrypt -inkey private_key.pem -in encrypt_message.dat -out decrypt_message.txt
The example code of this video have been uploaded onto GitHub for your reference:
https://github.com/yuanhui360/CPP-Pro...