Hybrid encryption
Symmetric encryption is fast but needs a shared key. Asymmetric encryption needs no shared secret but is slow and limited in size. Hybrid encryption uses each for what it does best.
The complete sequence
Genuine AES-GCM + RSA-OAEP Simulated networkHybrid encryption lab
GenuineEve intercepts the envelope
Why hybrid?
What happened
Which key is used where?
| Operation | Key used | Type |
|---|
Key ideas
Session key
A fresh, random symmetric key generated for one message or one connection, then thrown away. Each message gets a new one.
Data: symmetric
The message itself, however large, is encrypted with the session key (AES-GCM): fast and with integrity protection.
Key: asymmetric
Only the small session key (32 bytes) is encrypted with Bob's public key. This is sometimes called key wrapping.
Best of both
No shared secret is needed in advance (asymmetric), and large data is encrypted quickly (symmetric).
Relation to HTTPS / TLS
HTTPS is also hybrid: a short handshake with asymmetric cryptography establishes symmetric session keys, which then encrypt all the data.
But this tool is a simplified model. Old TLS versions did encrypt the session secret with the server's RSA public key, as shown here. TLS 1.3 no longer does this: browser and server agree on the secret with an ephemeral Diffie-Hellman exchange (Tool 6), and the server proves its identity with a certificate and a signature (Tools 8 and 7). The real handshake has many more details not shown here.
Common misconceptions
Where you meet hybrid encryption
Encrypted e-mail
PGP and S/MIME encrypt the e-mail with a random session key, then encrypt that key once for each recipient's public key.
Secure file exchange
Tools such as age or GPG encrypt files the same way, so large files stay fast to encrypt.
HTTPS, VPNs, messaging apps
All combine an asymmetric handshake with fast symmetric encryption of the data.
Challenges
1. Three recipients
Alice wants to send the same 10 MB file to Bob, Charlie and Dana. How many times must she encrypt the file? How many times must she encrypt the session key?
Show answer
2. Eve's best target
Eve recorded the envelope. What single piece of information would let her read the message? Where is it stored?