Public-Key Cryptography
Asymmetric Encryption
James Ellis, a British engineer, was working on something he called non-secret encryption. His idea is clever yet simple: lock and unlock are inverses. Use that as a one-way function, the same idea the key-exchange material turns on.Easy to lock, but hard to unlock. Anyone at all can push a padlock shut, including someone who has never seen that padlock before and owns no key to it. Getting it open again without the key is the hard half. That gap between the two directions is the whole idea.

Ellis's idea is an example of asymmetric encryption, also called public-key cryptography: encryption which uses a public key and a private key. One for encryption and one for decryption.
Someone can encrypt a message with the public key, but only the recipient, holding their private key, can decrypt it.
• the public key is used for encryption
• the private key is used for decryption
The sender does not need the receiver's private key to encrypt a message, but the receiver's private key is required to decrypt it.
The public key is called public because it is meant to be handed out. Its owner publishes it, gives copies to strangers, prints it on a website. The private key is never sent anywhere at all.
The other direction
When this course says public key encryption, it means the direction above: a public key for encryption and a private key for decryption. The reverse is also used, for digital signatures rather than for keeping secrets: the private key to encrypt, and the public key to decrypt.That direction is not secrecy. Everybody has the public key, so everybody can undo the encryption and read the message. What the operation proves instead is where the message came from, because only one person holds the private key that could have produced something the public key undoes.
That idea is developed later in this unit, under digital signatures. For now it is enough to know that the direction exists and that it does a completely different job.
| Encrypt with | Who can decrypt it | What that gives you |
|---|---|---|
| The recipient's public key | Only the recipient, using their private key | Secrecy |
| The sender's own private key | Anybody, using the sender's published public key | Evidence of who sent it, and no secrecy at all |
RSA
The most famous example of asymmetric encryption is RSA, named after its inventors Rivest, Shamir and Adleman. The mathematics behind RSA is beyond the scope of this course, and nothing here asks you to compute anything with it.A note on the history. Ellis wrote his report in 1970, for a British government agency, and it stayed classified until 1997. The first public description of the idea came from Whitfield Diffie and Martin Hellman in 1976, in the same paper that introduced their key exchange. Rivest, Shamir and Adleman announced RSA in 1977, the first practical public-key encryption method to be published.
The lockbox
Alice has a private key and a lockbox, and the lockbox is her public key. She wishes to receive an encrypted message from Bob. Here is the whole exchange, in order.• Alice sends Bob the lockbox. It is open, and it is not a secret; she does not mind at all who sees it on the way.
• Bob puts his message inside the lockbox and locks it. Locking is the one-way function, and it is the easy half.
• Bob sends the locked box back.
• Alice opens it with her private key and reads the message.
Notice what Bob never receives, and what never travels in either direction: Alice's private key. It stays with her for the entire exchange. There was nothing to negotiate and nothing to agree on beforehand.
One private key, however many correspondents
If Alice is a bank, she can duplicate the lockbox and send copies to everyone she wishes to receive encrypted messages from. She only has to manage one private key.Set that against what key exchange costs her. There, every correspondent means a fresh round of back-and-forth to agree a key, and a distinct key to store at the end of it; a bank would need thousands of both, and thousands of messages sent purely to set them up. Here she generates one keypair, publishes one half of it, keeps the other, and a new correspondent costs her nothing at all. Nobody has to agree on anything.