Asymmetric encryption with a public key and decryption with a private key can be illustrated with the following analogy: Public keys can be seen as open padlocks that can be distributed to anybody while the private key is the physical key to the padlocks. Once such a padlock is snapped close only the matching private key can unlock it. This allows anybody to put a message into a box and lock the box with the padlock. The sender can now be sure that only somebody who knows the private key can open the box and see the content.
Technology
·
Journey Of A Message
·
part 2
Medium
5 min
Part 2 of 3
Your Message Is Sealed Before It Leaves Your Phone
How a public lock and a private key keep your messages unreadable to everyone but the person you're texting
Share
Someone is watching every packet you send. Not hypothetically — literally. Every router your message passes through sees the data. So why can't they read it?
In part 1 of this series, we saw how a message gets sliced into packets and routed across the internet — hopping through dozens of routers before it reassembles on the other end. Those routers can see the packets. Which raises an obvious problem: if your message is just data bouncing through strangers' hardware, what stops anyone from reading it? The answer is encryption. Specifically, a trick so elegant it took mathematicians decades to figure out — and you use it hundreds of times a day without knowing.
Here's the core idea. Normally, if you want to lock something, you need the key to both lock it AND unlock it. Same key, both directions. That's how a house key works. The problem: how do you get that key to someone without handing it to them in person? If you send it over the internet, anyone watching can steal it before it arrives. Public-key cryptography solves this by splitting the job into two different keys. One key locks. A completely different key unlocks. They're a matched pair — mathematically linked — but knowing one doesn't tell you the other.
Make your call
When your phone connects to a website, who sends the first key — your phone or the website's server?
A
Your phone sends its key first, so the server can reply securely
B
The server sends a public key first, so your phone can lock its message
C
Both exchange keys at the same time, simultaneously
So the sequence looks like this. The server publishes its public key openly — it's not a secret, anyone can have it. Your phone uses that public key to lock the message before sending it. The locked message travels across every router on the planet. Any of them could copy it. None of them can read it, because the only key that unlocks it is sitting on the destination server and never left. This is why it doesn't matter that routers see your packets. They see a sealed box. The combination to open it exists in exactly one place.
Key Insight
The public key is like a mail slot. Anyone can drop a letter through it. But only the person with the key to the mailbox can take letters out. The slot and the key are not the same thing, and having one tells you nothing about the other.
The math underneath this relies on a specific type of problem that's easy to do in one direction and nearly impossible to reverse. Multiplying two enormous prime numbers together takes a fraction of a second. Figuring out which two primes produced a given product — even with the fastest computers alive — would take longer than the age of the universe. The public key is built from the product. The private key is built from the primes. Cracking it means working backwards, and that's the wall. Every time you see a padlock icon in your browser's address bar, this is what's happening. Your connection is sealed with math that no router, no government, no well-funded attacker can break in any reasonable timeframe. But one detail should bother you: all of this encryption, all of this mathematical sealing and verifying — it takes computation. And computation takes time. So how does a message cross an ocean and arrive in under 200 milliseconds? That's what part 3 is about.
Related threads
Technology
·
Your Message Doesn't Travel in One Piece
·
part 1
Your Message Doesn't Travel in One Piece
Technology
·
The Video That Didn't Come From the Source
·
part 3
The Video That Didn't Come From the Source
Sources
Images from Wikimedia Commons. Attribution required by license.
Asymmetric encryption with a public key and decryption with a private key can be illustrated with the following analogy: Public keys can be seen as open padlocks that can be distributed to anybody while the private key is the physical key to the padlocks. Once such a padlock is snapped close only the matching private key can unlock it. This allows anybody to put a message into a box and lock the box with the padlock. The sender can now be sure that only somebody who knows the private key can open the box and see the content.
Impossible To Find Free Username · CC BY-SA 4.0
public private key diagram
Generated by Grok Imagine (xAI), prompt: Generate a single 4:3 horizontal image for an educational lesson. Lesson title: "Your Message Is Sealed Before It Leaves Your Phone" · How a public lock and a private key keep your messages unreadable…
Quiz yourself