← Back to Library
SecurityBeginner10 min readJul 19, 2026By Tech-ikigai Instructors
🔒 The secret handshake of the internet

How does HTTPS keep your secrets safe?

Ever notice the little padlock 🔒 next to a website's address? That's HTTPS at work. Meet Amit, checking his balance on Bharat Bank's website — and let's follow exactly what his browser and the bank's server whisper to each other before a single rupee amount is shown!

📽️ Comic Strip: Amit Checks His Bank Balance

Same story, told in six panels — before we go step by step below.

1
🧑‍💻
"Let's check my Bharat Bank balance!"
2
🧑➡️🏦
psst psst...
"I know some secret codes — here's my list!"
3
🏦🪪
"Hello Amit! Here's my ID card — verified by a trusted authority!"
4
🧑🔍✅
check!
"ID card is genuine — the seal matches!"
5
🔓📦➡️
"Locker key ready — let's agree on a secret password."
6
🔒💰✨
"Balance: ₹42,350 — fully secure!"

✉️ Why bother with all this?

Plain HTTP is like an ordinary postcard sent by post. HTTPS is like a sealed, signature-required registered parcel.

📬

HTTP — a plain postcard

Anyone handling it along the way — a nosy neighbor, the postman, someone at the sorting office — can flip it over and read every word, including your password and OTP.

🔒📦

HTTPS — sealed registered parcel

Your message travels inside a locked box with a wax seal, and only the person it's addressed to has the key. Anyone who intercepts it sees a locked box — nothing readable inside.

🗺️ The handshake, as a flow chart

All of this happens in a fraction of a second, before a single word of your actual message is sent.

🧑 Browser: "Let's go secret!" Client Hello (codes I know) Server Hello + shows ID card (certificate) ID card signed by a notary I trust, and not expired? No ⚠️ "Not Secure" warning Yes ↓ Agree on a shared secret (key exchange) Switch to fast shared-secret encryption Real HTTP data flows, fully scrambled 🔒 Padlock appears — secure!
Success pathCertificate problem
1
Client Hello

"Shall we talk secretly?"

🤫 Like Amit walking up to the Bharat Bank counter and whispering, "Listen, I know all these secret codes — here's my list." Nothing secret is shared yet, just an offer to start talking.
  • Amit's browser sends a Client Hello message: a random number, the highest TLS version it supports, and a list of encryption methods ("cipher suites") it knows.
  • This is all sent in the open — no secrets here yet, just an introduction.
🔬 Technical note

The Client Hello also carries the SNI (Server Name Indication) field — literally the plaintext domain name (bharatbank.com), so a server hosting hundreds of websites on one IP knows exactly which certificate to hand back. This is also why network firewalls can still see which site you're visiting, even over HTTPS.

2
Server Hello + Certificate

"Hello! Here's my ID card."

🪪 Bharat Bank's server replies, "All right, let's use this code," and holds up its ID card — like showing an Aadhaar card issued and verified by a trusted authority — so Amit knows he's really talking to his bank, not a fraudster.
  • The server sends back a Server Hello and its SSL/TLS certificate.
  • That certificate holds the server's identity (CN=bharatbank.com), its public key, a validity period, and a digital signature from a trusted issuer.
🔬 Technical note

A real X.509 certificate is essentially a small signed document with fields like Subject, Issuer, Validity (Not Before / Not After), Public Key, and Signature Algorithm (e.g. SHA256withRSA). Type openssl x509 -in cert.pem -text -noout to see every field on a real certificate.

3
Chain of trust

Checking the ID card is real

🔍 Just like an immigration officer checks a passport's seal against a known government stamp before trusting it, Amit's browser checks the certificate's signature against a short list of trusted "notaries" (Certificate Authorities) already built into it.
  • The certificate is signed by a Certificate Authority (CA) — an organization trusted to verify identities, like DigiCert, Sectigo, or Let's Encrypt.
  • Browsers and operating systems ship with a "root store" of trusted root CAs. If the signature traces back to one of them, the ID card is genuine.
  • Wrong domain name, expired date, or unknown issuer → big red "Not Secure" warning.
🔬 Technical note

Certificates form a chain: Leaf (bharatbank.com) → Intermediate CA → Root CA. Root CA keys are kept offline and almost never used directly — they sign intermediates instead, so if an intermediate is ever compromised, it can be revoked (via CRL or OCSP) without touching the root.

🔎 Try it yourself
Click the padlock icon → "Certificate" openssl s_client -connect example.com:443 -showcerts
4
Key exchange

Agreeing on a secret, out loud, safely

🔓 Think of a bank locker: the bank's open padlock is public — anyone can snap it shut over a box. But only the matching private key (kept safely inside the bank) can open it again. Amit and Bharat Bank use this trick to agree on a brand-new secret password, even while a stranger is watching every step.
  • The server's certificate contains a public key anyone can use to lock a message.
  • Only the server's matching private key can unlock it — and that key never leaves the server.
  • Both sides use this trick to agree on a brand-new shared secret, without ever saying it plainly.
🔬 Technical note

Modern TLS mostly uses ECDHE (Elliptic Curve Diffie-Hellman Ephemeral) instead of plain RSA key exchange. Both sides generate a temporary key pair just for this one session and combine math to land on the identical shared secret — without ever transmitting it. Because the key is thrown away after the session, this gives Perfect Forward Secrecy (PFS): even if a server's long-term private key leaks years later, an attacker who recorded today's encrypted traffic still can't decrypt it.

5
Session key

Switching to a faster private language

🗣️ Now that they've secretly agreed on a password, both friends switch to a made-up language just between the two of them — much quicker to speak than fumbling with padlocks for every single sentence.
  • The padlock trick (asymmetric encryption) is clever but slow, so it's only used to safely share a secret.
  • From here, both sides use that shared secret with fast symmetric encryption for the entire conversation.
🔬 Technical note: reading a cipher suite name

A cipher suite like TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 is really four decisions bundled together:

  • ECDHE — how the key exchange happens
  • RSA — how the server proves its identity (signature)
  • AES_128_GCM — the actual symmetric cipher that scrambles your data
  • SHA256 — the hash used inside the handshake for integrity

In TLS 1.3, this got simplified — only strong AEAD ciphers like AES-GCM and ChaCha20-Poly1305 are allowed. TLS 1.3 also cuts the handshake from 2 round trips down to 1 (sometimes 0 for repeat visits) — which is why modern sites feel noticeably snappier.

6
Encrypted data

The real message, all scrambled up

🧩 Now your actual request — "please log me in" — gets sent, but scrambled into gibberish only your friend's shared secret can unscramble. Anyone snooping just sees noise.
  • Every bit of your HTTP request and response is now encrypted before it ever leaves your device.
  • Even the exact page you're viewing is hidden from anyone watching the network — only the destination address is visible.
🔬 Technical note

It's not just about hiding the message — it's also about proving nobody tampered with it. Ciphers like AES-GCM are AEAD (Authenticated Encryption with Associated Data): every encrypted chunk gets a built-in authentication tag. If even one bit is flipped in transit, the tag check fails and the connection is dropped instantly.

7
Padlock appears!

The safety signal you can see

🔒 Your browser shows a tiny padlock right next to the address — that's its way of saying, "Everything from here on is locked up tight, and I checked the ID card myself."
  • Click the padlock any time to see who really issued the certificate.
  • No padlock, or a warning triangle, means: stop and think before typing anything sensitive!
🔬 Technical note

Well-run sites like a bank add an HSTS (HTTP Strict Transport Security) response header — a rule telling the browser "never even try plain HTTP for this domain again, for the next N days." This stops a whole class of attacks where someone tricks you into visiting the unencrypted http:// version first.

🔎 Try it yourself
curl -v https://example.com 2>&1 | grep -i "SSL\|subject"

Shows the TLS handshake details and which certificate was presented.

🧩 HTTP vs HTTPS, side by side

HTTPHTTPS
Default port80443
Encrypted?No — plain textYes — fully scrambled
Browser icon"Not Secure"🔒 Padlock
Identity check?NoneCertificate verified against trusted CA
Good forNon-sensitive, static info onlyLogins, payments, personal data — basically everything today

🎓 Level Up: The Technical Deep Dive

For the curious ones who want to peek further under the hood.

⏱️ TLS 1.2 vs TLS 1.3

TLS 1.2 needs 2 full round trips before any data flows — Client Hello, Server Hello + Cert, key exchange, then Finished messages both ways.

TLS 1.3 (2018) squeezed this into 1 round trip, and added 0-RTT resumption for repeat visits — your second visit today can start sending encrypted data almost instantly.

🔁 Session resumption

Doing the full handshake every single time would be slow. So the server hands the browser a session ticket — an encrypted note it can show next time to skip straight to a shared secret, without redoing certificate checks from scratch.

🛡️ Perfect Forward Secrecy

Because each session's key is freshly generated and thrown away afterward (thanks to ECDHE), recording today's traffic and stealing the server's private key next year still won't unlock it.

🏷️ SNI — one server, many domains

A single AWS or hosting server often serves hundreds of websites off one IP address. Server Name Indication lets the browser say which domain it wants before encryption starts, so the server knows which certificate to present.

🧬 Anatomy of a cipher suite

TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 broken down:

ECDHE → key exchange RSA → authentication AES-128-GCM → encryption SHA256 → handshake integrity

🔐 HSTS — no downgrade allowed

The response header Strict-Transport-Security: max-age=31536000 tells the browser to remember, for a full year, that this domain must always use HTTPS — closing the door on a common trick where an attacker quietly downgrades your first request to plain HTTP.

The whole handshake, at a glance

1Client Hello
2Server Hello + Certificate
3Verify chain of trust
4Key exchange
5Switch to session key
6Encrypted data flows
7Padlock appears
Made with 🔒 for curious kids (and grown-ups) learning how the internet keeps secrets. Thanks for reading! 🙏
Share

Comments (0)

0/800
  • Be the first to comment.