Skip to main content
โ† Back to Cybersecurity samples
๐Ÿ›ก๏ธCybersecurityยท15 minยทSample Lesson

How Public-Key Encryption Lets Strangers Share Secrets Online

Every time you visit a website whose address starts with https, your browser and a server you have never met agree on a secret code in under a second, without ever meeting in person or sharing a password ahead of time. That trick is called public-key encryption, and it protects nearly every private message, bank login, and online purchase on the internet.

What You'll Learn

You will learn the difference between symmetric and asymmetric encryption. You will learn how a public key and private key work together. You will learn how digital signatures prove a message really came from you. You will also see where this technology shows up in everyday life, from HTTPS websites to banking apps.

Symmetric Encryption: One Key, One Problem

Symmetric encryption uses a single shared key to both lock and unlock a message, similar to a padlock and its one matching key. Algorithms like AES-256 are extremely strong and fast. The problem is delivery: before two people can use a symmetric key, they must somehow share that key secretly, and if anyone intercepts it while it is being shared, every future message is exposed.

Public-Key (Asymmetric) Encryption

Public-key encryption solves the sharing problem by using two related keys instead of one. Your public key can be given to literally anyone, even posted online, because it can only encrypt messages, not decrypt them. Only your private key, which you never share with anyone, can unlock messages that were encrypted with your public key. The RSA algorithm, published in 1977 by Ron Rivest, Adi Shamir, and Leonard Adleman, was one of the first practical versions of this idea and is still used today.

Why Private Keys Matter

If your private key is ever stolen or leaked, every message ever encrypted with your matching public key becomes readable to whoever has it. This is why private keys are stored in secure hardware and never transmitted over the internet.

Digital Signatures: Proving It's Really You

Public-key encryption also works in reverse to prove identity. When you sign a message with your private key, anyone can use your public key to confirm the signature is genuine and the message was not altered. Software companies use this to sign updates so your computer can verify the update really came from them, and banks use it to confirm the authenticity of transactions.

โ“

Why can a public key be shared with anyone, even posted on a website?

โ“

What is the main weakness of symmetric encryption compared to public-key encryption?

๐ŸŽฏ

Crack a Simple Cipher

With a partner, create a Caesar cipher by shifting each letter of a short message forward by 3 letters (A becomes D, B becomes E, and so on). Trade encoded messages and decode each other's. Then write two sentences explaining why this simple shared-key method would not be safe enough to protect a bank website.

Real-World Connection

Password managers use strong encryption to protect your saved logins. Even the company that made the app usually cannot read your stored passwords, because they never have your private decryption key.

Want to keep learning?

Sign up for free to access the full curriculum โ€” all subjects, all ages.

Start Learning Free