Asymmetric encryption
Each person has a key pair: a public key that anyone may know and a private key that never leaves its owner. What is encrypted with someone's public key can only be decrypted with their private key.
A public key to lock, a private key to unlock
Genuine RSA-OAEP Simulated networkAnalogy: Bob hands out open padlocks (public key). Anyone can snap one shut on a box. Only Bob has the key that opens them (private key).
Encryption lab
Genuine RSA-OAEP 2048-bitPublic key directory (anyone can read it)
Try this
What happened
Key ideas
A key pair
The two keys are generated together and belong together. What one key locks, only the other can unlock. You cannot compute the private key from the public key.
Public key: share it
public Publish it on a website, send it by e-mail, print it on a card. Everyone, even Eve, may have it.
Private key: never share it
private It stays with its owner. If it leaks, everything encrypted for that person can be read.
Encrypt for someone
To send Bob a secret, use Bob's public key. Only Bob's private key decrypts it. Not even the sender can decrypt it afterwards.
Solves key distribution
No shared secret is needed in advance. Bob can publish his public key openly: knowing it does not help Eve decrypt.
Slow and size-limited
RSA is much slower than AES and can only encrypt a few hundred bytes (190 bytes with the 2048-bit key here). That is why real systems use hybrid encryption.
Common misconceptions
Public-key cryptography has several uses
Where you meet asymmetric encryption
Encrypted e-mail
PGP and S/MIME encrypt messages for the recipient's public key (combined with symmetric encryption, see Tool 5).
SSH keys
When you run ssh-keygen, you create a key pair. The public key goes on the server, the private key stays on your computer. (SSH uses it for authentication, not for encrypting data.)
Protecting keys
Asymmetric encryption is mostly used to protect a small symmetric key, which then protects the real data.
Challenges
1. Which key?
Charlie wants to send a confidential message to Bob. Which key does Charlie use? Which key does Bob use?
Show answer
2. Eve has everything public
Eve has every public key and every ciphertext. In the lab, let Eve try to decrypt. Why does she fail?
Show answer
3. The long message
Try to encrypt a 300-character message. What happens, and how do real systems solve it?