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 End-to-end encryption: how a message stays locked all the way to your friend's phone

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

Public and private keys: the key your phone can show to everyone

Your phone has two keys: a private key that it keeps secret, and a public key that it can show to everyone. With these keys, two phones that never met end up with the same secret key, and the server never learns it.

  1. 1 Go back to the day Miva installed the app. Her phone made a pair of keys: first a private key, a long random number, then a public key, worked out from the private one.Miva's phoneprivate keyworked outfrom itpublic key

    Go back to the day Miva installed the app. Her phone made a pair of keys: first a private key, a long random number, then a public key, worked out from the private one.

  2. 2 The working out goes one way only. From the private key, the phone gets the public key in a blink. From the public key, no known method finds the private key, even with a crowd of computers working for years.private keypublic keyin a blinkno way back

    The working out goes one way only. From the private key, the phone gets the public key in a blink. From the public key, no known method finds the private key, even with a crowd of computers working for years.

  3. 3 So the private key never leaves Miva's phone. The public key goes up to the chat server, which keeps it for anyone who wants to write to her.private key:never leavesMiva's phonechat serverMiva'spublic key

    So the private key never leaves Miva's phone. The public key goes up to the chat server, which keeps it for anyone who wants to write to her.

  4. 4 Your phone did the same when you installed the app. Now the server holds both public keys, and Rono can stare at them all day: on its own, a public key opens nothing.chat serveryourpublic keyMiva'spublic keyRonoSo many keys,and not oneopens a thing.

    Your phone did the same when you installed the app. Now the server holds both public keys, and Rono can stare at them all day: on its own, a public key opens nothing.

  5. 5 Miva's phone is still switched off in her bag. Her public key, though, waits on the server, and that is all your phone needs to start a locked chat with her.your phonechat serverMiva'spublic keyMiva's phoneswitched off

    Miva's phone is still switched off in her bag. Her public key, though, waits on the server, and that is all your phone needs to start a locked chat with her.

  6. Quick check

    A thief copies every public key on the chat server.Do you neednew keys now?

    A thief copies every public key on the chat server.

    Show the answer

    No. A public key is made to be seen, and it does not lead back to the private key, which never left your phone.

  7. Go further

    One name to keep.public-key cryptographythe maths of key pairs likethese, a private key and apublic key worked out from it.It was first published in 1976

    One name to keep.

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

Share this comic

More comics