$ openssl s_client -connect shop.com:443 # RFC 8446 (TLS 1.3)

HTTPS

HTTPS is plain HTTP sent inside a TLS (Transport Layer Security) connection, usually on port 443. TLS gives three guarantees: confidentiality (nobody on the path can read the data), integrity (nobody can change it unnoticed) and authentication (you are really talking to shop.com, proven by a certificate). “SSL” is the name of TLS’s long-dead predecessor; every SSL version and TLS 1.0 and 1.1 are deprecated. Use TLS 1.3, with 1.2 as a fallback.

The TLS 1.3 handshake

$ openssl s_client -connect shop.com:443 -tls1_3
TLS 1.3 handshake: one round trip to encrypted data
CLIENT browser SERVER shop.com:443 ClientHello key_share, SNI ServerHello key_share derive keys derive keys {EncExt, Certificate, CertVerify, Finished} check chain + hostname {Finished} {GET / HTTP/1.1} {200 OK ...}
NO.STEPFROMTOTYPEINFO
101clientserverClientHelloTLS 1.3, ciphers: TLS_AES_128_GCM_SHA256 …, SNI=shop.com, key_share: X25519MLKEM768
202serverclientServerHellochosen cipher + server key_share → both derive handshake keys
303serverclientENCRYPTEDEncryptedExtensions, Certificate (shop.com ← intermediate CA), CertificateVerify, Finished
404clientclientVERIFYchain → root CA in trust store · not expired · SAN matches shop.com
504clientserverENCRYPTEDFinished
605clientserverAPP DATAHTTP request, AES-GCM encrypted
  1. A TCP connection to port 443 is open. Nothing is encrypted yet.
  2. ClientHello: supported versions and ciphers, the server name (SNI), and a key share: the client's half of a key exchange.
  3. ServerHello carries the server's key share. Both sides now compute the same shared secret without ever sending it.
  4. Everything from here is encrypted ({ } = encrypted). The server sends its remaining settings and its certificate, then signs the handshake with its private key to prove it owns it.
  5. The client checks the certificate chain up to a trusted CA, the expiry and that the name matches shop.com, then sends Finished.
  6. Application data flows encrypted. The whole handshake took one round trip (TLS 1.2 needed two).

Two kinds of cryptography work together:

  • Key exchange (ECDHE with X25519, and since 2024 to 2025 hybrid post-quantum X25519MLKEM768 by default in major browsers, Cloudflare and OpenSSL 3.5) lets both sides agree on a secret over an open network. New keys per connection give forward secrecy: stealing the server’s private key later does not decrypt old traffic.
  • Signatures and certificates prove identity. The server’s certificate binds its public key to the name shop.com and is signed by a certificate authority (CA) that your OS or browser already trusts.

After the handshake, data is encrypted with a fast symmetric cipher such as AES-GCM or ChaCha20-Poly1305.

The chain of trust

Certificate Signed by Lives in
Leaf: shop.com Intermediate CA Sent by the server
Intermediate CA Root CA Sent by the server
Root CA Itself Your trust store (OS, browser, JVM cacerts, Python certifi)

Let’s Encrypt and other ACME CAs issue free certificates automatically. Lifetimes are shrinking: the CA/Browser Forum has voted to cut maximum validity from 398 days to 200 days (March 2026), 100 days (2027) and 47 days (2029), so certificate renewal must be automated.

Common mistakes

  • Disabling verification to “make it work” (verify=False, curl -k, sslmode=require without verify-full). The connection is encrypted but you no longer know who is on the other end.
  • The server sends only the leaf certificate. Browsers may cope; Python, Java and Go clients fail with “unable to get local issuer certificate”. Serve the full chain.
  • Corporate proxies with their own CA. Add the company root to the trust store your runtime actually uses (Java and Python often have their own).
  • Expired certificates. The top cause of HTTPS outages. Automate renewal and alert on expiry.
  • Mixed content. An HTTPS page that loads scripts over HTTP is blocked by browsers.

Try it

curl -vI https://shop.com 2>&1 | grep -E 'SSL|TLS|subject|issuer|expire'
openssl s_client -connect shop.com:443 -servername shop.com </dev/null | openssl x509 -noout -dates -subject

Learning Resources

See also: HTTP, SSH.