In this Example we will see how to communicate between two parties with encrypted messages without sharing the public key.
The first party party1 will encrypt the message with its public key and send the message to party2. Party2 will again encrypt the message with its public key and send the message back to party1. Then party1 will decrypt the message with its private key and send the message back again to party2. Party2 will then decrypt the message with its private key and retrieve the original decrypted message.
The first party party1 will encrypt the message with its public key and send the message to party2. Party2 will again encrypt the message with its public key and send the message back to party1. Then party1 will decrypt the message with its private key and send the message back again to party2. Party2 will then decrypt the message with its private key and retrieve the original decrypted message.