The Problem with Diffie-Hellman
Diffie-Hellman lets Alice and Bob compute a shared secret over an insecure channel.
But it has a critical weakness: no authentication.
Alice sends her public value to Bob. But how does Bob know it actually came from Alice?
Man-in-the-Middle Attack
Eve sits between Alice and Bob:
- Alice sends intended for Bob
- Eve intercepts, sends her own to Bob
- Eve sends her own to Alice
- Alice computes a key with Eve (thinking it’s Bob)
- Bob computes a different key with Eve (thinking it’s Alice)
Eve now reads all messages. Decrypts with one key, re-encrypts with the other.
Alice and Bob think they’re communicating securely. They’re not.
The Solution
Authenticate during the key exchange.
Prove your identity while exchanging keys. Three protocols do this:
- Signed DH - sign your public value
- Station-to-Station (STS) - sign and encrypt
- SIGMA - sign and MAC
Signed Diffie-Hellman
The simplest fix: sign your DH public value.
How It Works
- Alice generates her DH value
- Alice signs it:
- Alice sends both and to Bob
- Bob verifies the signature using Alice’s public key
- Bob does the same in reverse
- Both compute the shared secret
If Eve tries to substitute her own value, she can’t forge Alice’s signature.
Weakness
The signatures are sent in the clear.
- Anyone watching can see Alice and Bob exchanged keys
- No deniability - proof exists that they communicated
- Signatures could potentially be replayed
Station-to-Station (STS)
A more robust protocol: encrypt the signatures.
How It Works
- Alice sends (unsigned)
- Bob sends (unsigned)
- Both compute the shared secret
- Bob signs both values:
- Bob encrypts the signature with :
- Bob sends the encrypted signature to Alice
- Alice decrypts, verifies Bob’s signature
- Alice does the same back to Bob
Why Encrypt the Signature?
- Proves knowledge of - only someone who computed the shared secret can encrypt/decrypt
- Hides the signature - eavesdroppers can’t see who’s communicating
- Stops Eve - she can’t produce a valid encrypted signature without knowing
SIGMA Protocol
Used in real-world protocols like IKE (IPsec key exchange).
Adds a MAC to bind identity to the session.
ID is the party’s public key or certificate. It’s encrypted so eavesdroppers can’t see who’s communicating.
How It Works
- Exchange DH values, compute shared secret
- Derive two keys from : encryption key and MAC key
- Alice sends:
- Her identity (encrypted)
- Signature on the transcript
- MAC on her identity
- Bob verifies both signature and MAC
- Bob does the same back
Why the MAC?
The signature proves: “I am Alice”
The MAC proves: “I am Alice, and I computed this specific shared secret”
This prevents identity misbinding attacks - taking a signature from one session and using it in another.
Which Protocol to Use?
- Signed DH - simple, but signatures are exposed
- STS - better privacy, signatures encrypted
- SIGMA - strongest, used in production protocols
Real protocols like TLS use variations of these ideas: DH for key exchange, certificates for authentication.