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 Public and private keys: the key your phone can show to everyone

How end-to-end encryption works: why even WhatsApp cannot read your messages

Key exchange: how two phones build one key while one is switched off

A key exchange lets two phones make the same secret key without ever sending it. In an end-to-end encrypted app, it works even when your friend's phone is switched off. How is that possible?

  1. 1 Your phone sets Miva's public key beside your own private key. The maths of key pairs combines the two into a brand-new key.yourprivate key+Miva'spublic keya new key

    Your phone sets Miva's public key beside your own private key. The maths of key pairs combines the two into a brand-new key.

  2. 2 That new key scrambles your message. Off it goes through the server, with your public key clipped to it.your phonechat server9#vQ!x2&Lmyour public key

    That new key scrambles your message. Off it goes through the server, with your public key clipped to it.

  3. 3 That evening, Miva switches her phone on. It combines your public key with her private key, and out comes the very same key. Your message opens.Miva'sprivate key+yourpublic keythe same keyballoon ride!Miva

    That evening, Miva switches her phone on. It combines your public key with her private key, and out comes the very same key. Your message opens.

  4. 4 Two different pairs of keys, one result. Each phone uses its own private key and the other's public key, and both land on exactly the same key.on your phone+on Miva's phone+the same

    Two different pairs of keys, one result. Each phone uses its own private key and the other's public key, and both land on exactly the same key.

  5. 5 Rono holds both public keys as well. But every mix that works needs one private key, and those never left your phones. This is a key exchange, done through a server while one phone sleeps.yourpublic key+Miva'spublic keyRono

    Rono holds both public keys as well. But every mix that works needs one private key, and those never left your phones. This is a key exchange, done through a server while one phone sleeps.

  6. 6 One step still rests on trust. Your phone took the key the server handed over and believed it was Miva's. But the server is the one Rono looks after. What if he hands you a key of his own?chat serverRonoMiva's public keyyour phone?

    One step still rests on trust. Your phone took the key the server handed over and believed it was Miva's. But the server is the one Rono looks after. What if he hands you a key of his own?

  7. Go further

    Two names to keep.Diffie-Hellmanthe name of this kind of keyexchange, after Whitfield Diffieand Martin Hellman, whopublished it in 1976one-time keysMiva's phone also leaves asmall stack of extra publickeys on the server. Each newchat with her takes one ofthem, once, while thestack lasts

    Two names to keep.

Next episode Fake public keys: what if the chat server hands you the wrong key?

Share this comic

More comics