Public-key cryptography, also called asymmetric cryptography, is a communication where people send messages that can only be read by those who have the key.
In public key cryptography, each user has a pair of cryptographic keys:
The private key is kept secret, while the public key may be widely distributed and used by other users.
Incoming messages are encrypted with the recipient's public key and can only be decrypted with their corresponding private key. The keys are related mathematically, but the user's private key cannot be easily got from the widely used public key. The most usual problem with this method arises when private key is accidentally leaked.
The two main branches of public key cryptography are:
They are often used together on the same message.