TLS and HTTPS

The "s" in HTTPS is TLS, and it does three things at once that most engineers conflate: it encrypts the connection, verifies you're talking to the real server, and detects tampering. Understanding how — the handshake, the certificates, the chain of trust — demystifies the padlock icon and the certificate errors that block deploys, and it's foundational to every secure connection you make.

DNS gave you the server’s address; TCP will connect you; but over the open internet, anyone on the path can read or alter unencrypted traffic. TLS (Transport Layer Security) is what makes a connection private and authenticated — it’s the layer that turns HTTP into HTTPS. This post covers what TLS guarantees, how the handshake establishes a secure channel, how certificates prove server identity, and the performance cost that connects back to the connection-reuse theme.

What TLS guarantees

TLS provides three distinct security properties on a connection, and separating them clarifies a lot:

All three matter together: encryption keeps it private, authentication ensures it’s the right party, integrity ensures it wasn’t changed. HTTPS is simply HTTP running over a TLS-secured connection, gaining all three. A common mistake is thinking HTTPS is “just encryption” — the authentication (are you really talking to your bank?) is equally essential.

The handshake: establishing a secure channel

Before encrypted data flows, TLS performs a handshake to agree on how to secure the connection and to verify the server’s identity. Conceptually:

(after the TCP handshake completes)
Client → Server:  "Hello" — TLS versions and cipher suites I support, random data
Server → Client:  "Hello" — chosen version/cipher, the server's CERTIFICATE, random data
Client:           verifies the certificate (is this really the server? — below)
Both:             use key exchange to derive a shared SESSION KEY (without ever
                  sending it across the wire)
→ from here, all data is encrypted with the shared session key

The handshake accomplishes two things: negotiation (agreeing on the TLS version and cipher suite both support) and key establishment (deriving a shared symmetric session key via key exchange, so both sides can encrypt/decrypt without the key ever traveling the network). The clever part is asymmetric cryptography letting two parties who’ve never met agree on a secret key over a public channel — after which they switch to fast symmetric encryption for the actual data.

The cost: the handshake takes round-trips, adding latency on top of the TCP handshake. This is the compounding setup cost from the TCP post — an HTTPS connection pays the TCP handshake and the TLS handshake before any application data. Modern TLS (version 1.3) reduced this to about one round-trip (down from two), and session resumption can skip most of it for repeat connections — but the principle stands: new HTTPS connections have real setup latency, so reusing connections matters even more with TLS. This is a major reason keep-alive, connection pooling, and HTTP/2/3 (later posts) are so valuable.

Certificates and the chain of trust

The authentication property hinges on certificates. A TLS certificate is a document, presented by the server during the handshake, that binds a domain name to a cryptographic public key and is signed by a trusted authority. It’s how the client answers “is this really example.com?” The mechanism is a chain of trust:

Root CA (trusted, pre-installed in your OS/browser)
   │ signs
Intermediate CA
   │ signs
Server certificate (for example.com)
   → client verifies the chain up to a root it already trusts

This chain of trust is why certificate errors matter and must never be ignored: an invalid, expired, self-signed, or wrong-domain certificate means the authentication guarantee is broken — you might be talking to an impostor. The browser warning (“your connection is not private”) is TLS refusing to proceed because it can’t verify identity. Two everyday realities follow:

TLS in practice for backend engineers

TLS shows up in day-to-day backend work in a few recurring ways:

TLS is the security layer that makes the web trustworthy — private, authenticated, tamper-proof connections — at the cost of handshake latency that (again) rewards connection reuse. With a secure connection established, the next post covers what actually flows over it and how it evolved: HTTP, from 1.1 to 2 to 3.

Key takeaways

Further reading

Sources & References