How HTTPS Actually Works: TLS, Certificates, and Trust

Fractional CTO · Founder of Injuria.ai
Every time you load a secure site, your browser and the server run a short negotiation that keeps your traffic private and confirms the server is who it claims to be.[7] As of 2023, major browsers like Chrome and Safari replaced the padlock icon with a neutral settings or "tune" icon. The mechanism behind it, TLS, is one of the most important pieces of infrastructure on the internet, and it rests on a few ideas from cryptography that are worth understanding even if you never implement them yourself.[8]
Two kinds of keys
Encryption on the web uses two different approaches, and HTTPS needs both.
Symmetric encryption uses a single shared key to both scramble and unscramble data.[9] It is fast and well suited to encrypting a whole conversation. Its problem is obvious: both sides need the same secret key, and if you have never talked before, there is no safe way to agree on one over a network an attacker might be watching.
Asymmetric encryption, also called public-key cryptography, solves that. Each side has a pair of keys, a public key anyone can see and a private key that stays secret, and the two are mathematically linked so that what one does the other can undo. The catch is that asymmetric math is slow, historically too slow to use for an entire conversation. HTTPS combines them: it uses the asymmetric tools once, at the start, to safely bootstrap a shared secret, then uses fast symmetric encryption with that secret for everything after.[2][9]
The part everyone gets slightly wrong
It is tempting to say the server's public key is used to encrypt the shared secret. In modern TLS, that is not what happens, and the distinction matters. The server's certificate key (RSA or an elliptic-curve key) is used to sign the handshake, which proves the server's identity. The shared secret itself is agreed separately using ephemeral Diffie-Hellman, a method where both sides derive the same value without ever sending it across the wire.[1] In other words, one mechanism proves who you are talking to, and a different one establishes the secret. Older TLS did encrypt the secret directly with the server's RSA key, but that was removed because it lacked a property we now consider essential.
That property is forward secrecy. Because the Diffie-Hellman secret is ephemeral and thrown away after the session, stealing the server's private key later does not let an attacker decrypt past traffic they recorded. The historical "asymmetric is slow" complaint has also faded, because modern TLS leans on elliptic-curve cryptography such as X25519, which is far faster and uses much smaller keys than the old RSA approach.
The TLS handshake
The negotiation that sets all this up is the handshake. The browser opens with a hello that lists the cipher suites and TLS versions it supports, and it includes one easily overlooked but now essential field, the Server Name Indication, which names the hostname it wants to reach. SNI is what lets many different sites share a single IP address, because the server needs to know which certificate to present before it can present one.[1] The server replies with its choice and its certificate, the two sides perform the Diffie-Hellman exchange, and from that point the conversation is encrypted. TLS 1.3, the current version released in 2018, streamlined this to a single round trip and can resume a prior session in zero, which is a large part of why HTTPS stopped being a noticeable performance cost.[1]
Certificates and why you trust them
Privacy alone is not enough. If you secretly established a private channel with an attacker pretending to be your bank, the encryption would be perfect and useless. You need proof that the public key really belongs to the site you meant to visit, and that proof is the certificate: a document that binds a domain name to a public key, signed by a Certificate Authority whose job is to verify that whoever requested a certificate for example.com actually controls example.com.[3]
No single authority signs every certificate directly. There is a chain. Your browser and operating system ship with a built-in list of root certificates from a small set of trusted authorities. Those roots sign intermediate certificates, and the intermediates sign the certificate your site uses. When the server presents its certificate, your browser follows the chain upward until it reaches a root it already trusts. If every link checks out and nothing has expired or been revoked, the browser accepts it.
Two parts of that sentence hide real machinery. Revocation, deciding that a certificate issued in good faith should no longer be trusted, is handled through mechanisms like Certificate Revocation Lists and the Online Certificate Status Protocol, often stapled to the handshake so the browser does not have to make a separate request.[3] And because a rogue or compromised authority could in principle sign a certificate for a domain it has no business signing, modern browsers require certificates to appear in public, append-only Certificate Transparency logs, so that misissuance can be detected after the fact.[4] The whole system rests on that preinstalled list of roots, which is why those authorities are held to strict standards and why one misbehaving authority is treated as a serious event.
What the padlock does and does not mean
Major browsers removed the padlock icon in 2023 specifically because of this widespread misunderstanding, and the misunderstanding is actively dangerous. It means the connection is encrypted and the site presented a valid certificate for the domain you are visiting. That is genuinely valuable, because it stops anyone between you and the server from reading or tampering with the traffic. It does not mean the site is safe, honest, or run by who you assume. A scam site can get a valid certificate for its own domain in minutes. Scam sites no longer show a padlock in major browsers, as the icon was phased out in 2023. The padlock is a statement about the pipe, not about the person at the other end, and conflating the two is exactly how a convincing phishing page earns a user's trust.
Let's Encrypt and the day HTTPS became the default
For a long time certificates cost money and took manual effort, so a great deal of the web stayed unencrypted purely out of friction. That changed in 2015 with Let's Encrypt, a nonprofit authority that issues certificates for free and automatically through a protocol called ACME, so a server can request, install, and renew its certificate with no human involved.[5][6] The effect was dramatic. Encrypted traffic went from a minority of the web to the overwhelming majority in a few years, and browsers pushed the same direction by marking plain HTTP as not secure.
It is a near-perfect case study in layered engineering: fast symmetric encryption carries the data, public-key cryptography and Diffie-Hellman bootstrap and authenticate the secret, certificates and a chain of trust prove identity, transparency logs keep the authorities honest, and free automated issuance made all of it the default rather than a feature you paid for. The padlock is small. The amount of careful design standing behind it is not.
Sources (9)
- RFC 8446: The Transport Layer Security (TLS) Protocol Version 1.3
- High Performance Browser Networking: Transport Layer Security (Ilya Grigorik)
- RFC 5280: X.509 Public Key Infrastructure Certificate and CRL Profile
- RFC 9162: Certificate Transparency Version 2.0
- RFC 8555: Automatic Certificate Management Environment (ACME)
- Let's Encrypt: How It Works
- Stephen A. Thomas, SSL & TLS Essentials (John Wiley & Sons, 2000)
- William Stallings, Cryptography and Network Security (Prentice Hall, 2011)
- Joshua Davies, Implementing SSL / TLS Using Cryptography and PKI (John Wiley and Sons, 2011)