You are signed in. Close

You are signed out. Close

Thank you. Your subscription has started. Close

Thank you. You will get an email when a new comic comes out. Close

We could not confirm your payment. If you paid, use the link "Sign in" at the bottom of the page. Close

Something went wrong on our side. Please try again in a moment. Close

Previous episode Encryption: how HTTPS turns every message into nonsense for everyone but the website

What the HTTPS padlock means: how your browser talks in secret on a Wi-Fi anyone can read

Diffie-Hellman key exchange: how your phone and a website build the same key without sending it

Your phone and a website want to talk in secret. For that, they need the same secret key. But anyone can listen to every message they send to agree on the key. So they cannot just send the key.

  1. 1 The trick fits in pots of paint. Both ends start from the same yellow, which anyone may know. Each one stirs in a secret color of its own and keeps that color to itself.known to allMiva's phoneits secretits mixshop.exampleits secretits mix

    The trick fits in pots of paint. Both ends start from the same yellow, which anyone may know. Each one stirs in a secret color of its own and keeps that color to itself.

  2. 2 They send each other their mixes, in the open. Rono copies both, and they don't help him: paint is easy to mix and very hard to un-mix, so no copy gives back a secret color.Miva's phone's mixthe shop's mixRono's copiesRonoGot bothmixes!

    They send each other their mixes, in the open. Rono copies both, and they don't help him: paint is easy to mix and very hard to un-mix, so no copy gives back a secret color.

  3. 3 Now each end stirs its own secret into the mix it received. Both pots hold yellow, coral and teal: the same color. That color is the key, and it never crossed the Wi-Fi.Miva's phone+shop.example+the same color:the key

    Now each end stirs its own secret into the mix it received. Both pots hold yellow, coral and teal: the same color. That color is the key, and it never crossed the Wi-Fi.

  4. 4 Rono pours his two copies together, but that pot holds the yellow twice, and the color is wrong. With numbers in place of paint, this is a key exchange, published by Whitfield Diffie and Martin Hellman in 1976. No known method undoes its arithmetic in a useful time.Ronoyellow twice:wrong color

    Rono pours his two copies together, but that pot holds the yellow twice, and the color is wrong. With numbers in place of paint, this is a key exchange, published by Whitfield Diffie and Martin Hellman in 1976. No known method undoes its arithmetic in a useful time.

  5. 5 Miva's phone now shares a secret key with whoever sent the other mix. It took that mix on trust. What stops Rono from sending one of his own?Miva's phone?the other mix:from whom?RonoA mix ofmy own?

    Miva's phone now shares a secret key with whoever sent the other mix. It took that mix on trust. What stops Rono from sending one of his own?

  6. Quick check

    Rono copied the yellow and both mixes. What is he missing to build the key?The yellow andboth mixes. Whatis missing?

    Rono copied the yellow and both mixes. What is he missing to build the key?

    Show the answer

    One of the two secret colors. They never left Miva's phone or the shop's server.

  7. Go further

    The real names behind the paint.key sharewhat the rules of HTTPS calla mix: a number sent in the openDiffie-Hellman-Merklethe name Martin Hellmanprefers: Ralph Merkle hada first idea of the trick

    The real names behind the paint.

Next episode Man-in-the-middle attack: why a secret key is useless with the wrong person

Share this comic

More comics