Level 3 · 3B Encryption · Lesson 3 of 3
Public keys, HTTPS and the padlock
Asymmetric encryption uses a pair of keys that go together: a public one and a private one. What's encrypted with the public key can only be opened with the private key. The public key can be given to everyone; the private key never leaves your device.
What the key pair is for
So someone can send you something encrypted without having met you beforehand to agree on a key: they use your public key. And for signing: what you sign with your private key, anyone can check with your public key. That's how SSH server access, update signatures and website certificates work.
ls ~/.ssh
cat ~/.ssh/id_ed25519.pub- Your SSH keys live in ~/.ssh: id_ed25519 is the private one and id_ed25519.pub the public one.
- The one ending in .pub is the one you share, for example so a server lets you in. The other one is never sent.
HTTPS and the padlock
When you visit a site with HTTPS, it shows you a certificate saying “this public key belongs to this domain”, vouched for by an authority your browser trusts. That key is used to agree on a session key, and from then on everything travels with symmetric encryption. That's what the padlock means: the connection to THAT domain is encrypted. It doesn't mean the site is honest.
Going deeper
End-to-end encryption
In apps like Signal or WhatsApp, each phone has its own keys and messages are encrypted on your phone and decrypted on the other person's. The server carries them but can't read them. That's why, if someone asks you for “the code to verify your account”, they're asking for the key to register your number on another phone.
Review questions
Which of your SSH keys can be shared?
Answer: The public one (id_ed25519.pub). The public key exists to be shared; the private key identifies you and never leaves your device.
A site has the HTTPS padlock. What does it guarantee?
Answer: That the connection to that domain is encrypted. The padlock is about how the data travels, not about the intentions of the domain's owner.
What's the point of signing something with your private key?
Answer: So anyone can check with your public key that you made it and that it didn't change. A signature proves origin and integrity: if someone changes anything, the signature stops matching.