Three-Pass Protocol

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

  1. Alice puts the message in a box, adds her padlock, sends to Bob
  2. Bob can’t open it, so he adds his padlock too, sends back
  3. Alice removes her padlock, sends to Bob
  4. 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:

EA(EB(m))=EB(EA(m))E_A(E_B(m)) = E_B(E_A(m))

EAE_A and EBE_B 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 mm. Both have their own secret keys.

PassActionWhat’s Sent
1Alice encryptsc1=EA(m)c_1 = E_A(m)
2Bob encryptsc2=EB(EA(m))c_2 = E_B(E_A(m))
3Alice decryptsc3=DA(c2)=EB(m)c_3 = D_A(c_2) = E_B(m)
-Bob decryptsm=DB(c3)m = D_B(c_3)

What Encryption is Commutative?

XOR is commutative:

aba=ba \oplus b \oplus a = b

But using XOR here is insecure. If Eve captures all three messages:

c1c2c3=mc_1 \oplus c_2 \oplus c_3 = m


Modular exponentiation works better:

  • Encrypt: EK(m)=mKmodpE_K(m) = m^K \mod p
  • Decrypt: DK(c)=cK1modpD_K(c) = c^{K^{-1}} \mod p

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.