How does HTTPS work?
How can a site keep a secret from everyone on the line? Guess first, then try key exchange with real numbers and see what a certificate proves.
- 1Plain HTTP can be read and changed by everyone on the way5 min
- 2Only the key is secret, and a long key can't be guessed5 min
- 3Two strangers can agree a secret in public7 min
- 4A certificate shows who you've agreed the secret with7 min
- 5HTTPS hides the content, not the destination5 min
Sound like you?
The ideas people most often get wrong on the way, in their own words. Each step starts from one of them.
The short answerRather read it than work it out?Show it (it gives the steps away)
A request crosses many machines: your router, your provider and several networks between. With plain HTTP each can read the whole thing and change it. That's true for every page, not just login pages, which is why HTTPS exists: to make the data meaningless to everyone except the two ends.
Modern encryption uses a published method and a secret key. Anyone can study how AES scrambles, so the method gets tested by thousands of people. Only the key must stay private, and a 128-bit key has about 3.4 x 10^38 possibilities, too many to guess even at a trillion tries a second.
With key exchange, each side picks a private number, mixes it into a shared public one, and sends only the result. Each then mixes the other's result with their own secret and both reach the same number. With g = 5 and p = 23, Alice's 6 and Bob's 15 both lead to the secret 2, though neither secret is ever sent.
Key exchange alone can't tell you who is at the other end: an attacker in the middle could agree one secret with you and another with the site. So the site sends a certificate, signed by an authority your browser already trusts, tying its name to its key. The padlock means the connection is private to that exact address; it says nothing about whether the owner is honest.
After the handshake, the data is scrambled with the agreed key using a fast cipher. That hides pages, forms and cookies, but the networks in between can still see which server you connect to, usually its name, when, and roughly how much data. HTTPS keeps the content private; it doesn't make you anonymous.
Learn it with your own tutor.
Add it to your goals and Cognosc starts from what you already know, works through the rest with you, and keeps checking you still understand it.