The exact domain this certificate is issued for. Your browser checks that it matches the address bar precisely. Even a single extra letter, like onlinebankinng.example, would fail this check.
If you're reading this over Wi-Fi you don't fully control, your device and this server are exchanging data across a network neither of you can fully see. Anyone positioned along that route could, in principle, capture every packet (message) that passes by.
Encryption is the layer that makes this irrelevant: even if the data is intercepted, it can't be read. The real question isn't whether your data can be seen in transit: it's what an attacker can actually do with it once they have it. That's what this lesson is about.
Plaintext, Ciphertext, and Keys
An encryption algorithm transforms readable plaintext into unreadable ciphertext, using a key, a piece of information that controls exactly how the transformation happens. Change the key, and the same plaintext produces completely different ciphertext.
Try it below with one of the oldest encryption methods on record: the Caesar cipher, which shifts every letter a fixed number of places through the alphabet. The amount that each letter shifts is the key.
Use the slider to set a shift key and encipher the message below. Then, select the "Decipher" button to watch a computer try every possible key until it finds the one that deciphers the message.
That's the core weakness of any scheme with too small a key space: if there are few enough possible keys, brute force finds the right one. Modern algorithms don't fix this by hiding how they work (the method is usually public); they fix it by making the key space astronomically large.
Symmetric vs Asymmetric Encryption
Every practical encryption system has to solve two problems: how to scramble the message, and how the sender and receiver agree on a key without anyone else getting hold of it. Symmetric and asymmetric encryption differ mainly in how they solve that second problem.
Symmetric
One shared secret key both encrypts and decrypts. It's fast, but Alice and Bob both need the exact same key before they can talk securely, which means that key has to be delivered somehow. Whatever route it takes to reach Bob, that moment of delivery is a risk.
Asymmetric
Each person has a matched key pair: a public key, shared freely, and a private key, kept secret and never sent anywhere. Only the private key can decrypt what the public key encrypted.
Alice and Bob need to share one secret key before they can talk. Press send to watch the exchange.
- No activity yet: press send to begin.
This is the reason HTTPS, secure messaging apps and online banking rely on asymmetric encryption to get started, even though it's slower than symmetric encryption. In practice, most systems use asymmetric encryption just long enough to safely agree on a temporary symmetric key, then switch to symmetric encryption for the rest of the conversation, because it's faster.
Hashing Isn't Encryption
Encryption is designed to be reversed: with the right key, ciphertext transforms back into original plaintext. Hashing is designed to be a one-way street. A hash function takes input of any length, from a single letter to a multi-gigabyte file, and maps it to a fixed-length string of characters called a digest. It achieves this by scrambling the input's bits through multiple rounds of mathematical operations like shifting, combining, and mixing until the output bears zero resemblance to the original.
Unlike encryption, which relies on a key to reverse the process, hashing cannot be undone for two fundamental reasons. First, the mathematical operations used during mixing have no clean inverse to run backward. Second, squeezing arbitrary amounts of data into a fixed-size digest intentionally discards information. Because multiple different inputs could technically yield the identical digest (a collision), there is no unique original to recover. It is less like locking a document in a safe and more like blending fruit into a smoothie: no amount of skill can run the blender in reverse to get your whole apple back.
Illustrative digest, not a real cryptographic hash algorithm.
Type anything below: one letter or a full paragraph. The digest never changes length.
That unpredictability, combined with the lack of any reverse key, means the only way to figure out what created a specific digest is to guess inputs, hash them, and compare results. This one-way design is precisely what makes hashing ideal for password security. A system verifies your login by hashing the password you type and comparing the result to the stored digest, allowing it to validate your identity without ever needing to store (or even know) your actual password.
Digital Certificates
Asymmetric encryption solves key distribution, but it raises a new question: if Bob's public key just appears from somewhere, how does Alice know it's really his, and not an attacker's? A digital certificate answers that. It's Bob's public key, bundled with his identity, and digitally signed by a Certificate Authority, an organisation both Alice's browser and Bob already trust.
When Alice's browser connects, it checks that signature before trusting the key at all. That check, repeated automatically thousands of times a day, is what the small padlock next to a web address is actually reporting.
Real browsers let you inspect a certificate behind the padlock. Click each field below to see what it means and why it's checked.
The Certificate Authority that verified this domain and signed the certificate. Browsers only trust a small, built-in list of these authorities. A certificate signed by anyone outside that list, including one that simply signs itself, gets flagged as untrusted.
Certificates expire on purpose. A shorter lifespan limits how long a compromised key could keep being trusted before anyone notices. An expired certificate is treated the same as an untrusted one.
The actual public key this certificate is vouching for. Once everything else checks out, this is the key your browser uses to encrypt data meant for this server, the same kind of public key from the asymmetric encryption earlier in this lesson.
A cryptographic signature over every other field on this certificate, produced with a private key. Change the domain or the public key by even one character, and the signature no longer matches, which is what makes tampering detectable. But anyone can produce a signature, including the certificate itself. What actually makes it trustworthy is whether that signature came from a recognised Certificate Authority rather than from the certificate signing itself.
Every one of those fields exists to answer the same question: does this public key really belong to who it claims to? Get that answer wrong, and it doesn't matter how strong the encryption is afterward: you'd just be encrypting very securely to the wrong person.
Implement the Secure Handshake
You've been asked to build the login flow for a banking site. There are four decisions needed to secure the connection, all while someone else is watching the transaction:
- Verify who you're talking to.
- Agree on a key without leaking it.
- Move the data efficiently.
- Decide how to protect the password sent at login.
Make all four decisions then conduct a security review of your implementation.
Your login flow is connecting to https://secure-bank.com. Two certificates come back, both claiming to belong to that domain. Which one should you trust?
With the certificate check handled, your login flow needs to send a new session key to the server so both sides can switch to something faster. Someone else is watching the transaction the whole time.
A session key has been sent. Now you need to stream a 500 MB account archive between client and server. Which approach fits?
Last step: authenticate with your account password, SuperSecret123. How should it be handled?