The Problem
Alice wants to send Bob a secret message.
But they have:
- No shared key
- No public key infrastructure
- Just an insecure channel
How can they communicate securely?
The Padlock Analogy
Imagine Alice wants to send Bob a physical box with a secret inside.
She can’t send the key separately - Eve might intercept it.
The clever solution:
How It Works
- Alice puts the message in a box, adds her padlock, sends to Bob
- Bob can’t open it, so he adds his padlock too, sends back
- Alice removes her padlock, sends to Bob
- Bob removes his padlock, reads the message
Two padlocks, three passes, no shared key needed!
The Cryptographic Version
This works because of commutative encryption - encryption that can be applied and removed in any order:
and are Alice’s and Bob’s encryption functions.
Like padlocks - it doesn’t matter which one you put on first.
Protocol Steps
Alice has message . Both have their own secret keys.
| Pass | Action | What’s Sent |
|---|---|---|
| 1 | Alice encrypts | |
| 2 | Bob encrypts | |
| 3 | Alice decrypts | |
| - | Bob decrypts |
What Encryption is Commutative?
XOR is commutative:
But using XOR here is insecure. If Eve captures all three messages:
Modular exponentiation works better:
- Encrypt:
- Decrypt:
This is commutative and secure (related to Diffie-Hellman).
Advantages
- No pre-shared secret needed
- No public key infrastructure needed
- Works with symmetric-style operations
Disadvantages
- Three round trips - slow for real-time communication
- No authentication - vulnerable to man-in-the-middle attacks
- Eve could intercept and substitute her own padlocks
The Takeaway
The Three-Pass Protocol shows you can exchange secrets without any prior setup - just commutative encryption and patience for three trips.
In practice, we use faster methods like Diffie-Hellman. But this protocol demonstrates a beautiful cryptographic idea.