How does a
key pair work?

How Does a Public/Private Key Pair Work?

With public key cryptography, the private key is kept secure and private while the public key is publicly available. Here is an example of how the keys work to facilitate the exchange of confidential communications or a shared secret: If Alice and Bob want to exchange a secret message, Alice (the sender) will encrypt the message using Bob’s (the recipient) public key. When Bob receives the message, he will decrypt the message with his private key. No other parties can decrypt the message unless they have Bob’s private key.