What is Cryptography?

Asymmetric Encryption

This key exchange problem is a big part of why asymmetric encryption has become so popular. It allows Alice and Bob to communicate securely without having to first agree on a shared secret or key. In asymmetric encryption, both Alice and Bob have two keys, a private key and a public key. 

Let's see how asymmetric encryption changes Alice and Bob's communication. Alice now generates a key pair, a private key, and a corresponding public key. Bob also generates a key pair, one private and one public. The math that makes this all possible is very interesting, but what is important to know here is that what gives this method so much utility is that a public key can be used to encrypt a message, but the corresponding private key is required to decrypt that message. 

With asymmetric encryption, Alice can give her public key to Bob and can do so out in the open. She can share it in a Tweet and pin it to her profile if she likes! Bob can then use that public key to encrypt a message to Alice in a way that makes it infeasible for anyone to be able to decrypt that message without Alice's private key. Not even Bob can decrypt that message. Once that message has been encrypted with Alice's public key, Alice's private key is the only key that unlocks that puzzle. 

This means that now Alice and Bob can exchange public keys with one another out in the open, and then use each other's keys to encrypt their private messages. Alice uses Bob's public key to encrypt messages to him, which can be decrypted with his corresponding private key. 

While these public and private keys were a huge advancement in cryptography, they can also be used for other functions, such as cryptographic signatures.