Encryption and certificates
TLS and certificates
Encryption plus proof of identity: the server shows a certificate for the name, signed by a trusted authority.
TLS encrypts a connection and proves who the server is. The server shows a certificate for the name you asked for, signed by a certificate authority, and proves it holds the matching private key. A wrong DNS answer or a machine in the middle lacks that key, so the client stops (curl exit 60); clicking through the warning throws that protection away. The name still travels in the clear (SNI).
How TLS works, step by step
TLS gives a TCP connection two things: encryption, and proof that the server is who the client asked for. HTTPS is HTTP inside TLS, on port 443. A TLS 1.3 handshake (RFC 8446) takes one round trip:
- ClientHello. The client sends the versions and cipher suites it supports, a key share (its half of an
ephemeral Diffie-Hellman exchange, usually X25519), the name it wants in the SNI extension, and the
application protocols it speaks in ALPN (
h2,http/1.1). This message is not encrypted, so the name is visible on the wire. - ServerHello. The server picks a suite and sends its own key share. Both sides can now compute the same secret, and everything after this is encrypted.
- Certificate. The server sends its certificate and the intermediate certificates that lead to a root.
- CertificateVerify. The server signs the handshake so far with its private key. This is the actual proof: anyone can copy a certificate, only the key's holder can produce this signature.
- Finished. Each side sends a MAC over the whole handshake, so tampering with any earlier message is detected.
Between steps 3 and 5 the client checks the certificate:
- The chain. Each certificate is signed by the next, up to a root CA already in the client's trust store. Servers send the intermediates; roots are never sent, because a root is only worth anything if the client already has it.
- The dates. Now must fall between
notBeforeandnotAfter. Publicly trusted certificates are short-lived on purpose: 200 days at most since March 2026, falling to 47 days by 2029, and ACME clients such as Let's Encrypt's renew them automatically. - The name. The name the client asked for must appear in the Subject Alternative Name extension. Modern clients ignore the old Common Name field.
If any check fails, the client stops before sending a single byte of the request.
What it looks like on a Linux machine
In the HTTPS and TLS lab curl -v prints the handshake and the certificate it
checked:
$ curl -sv https://shop.lab/
* SSL connection using TLSv1.3 / TLS_AES_256_GCM_SHA384 / x25519 / id-ecPublicKey
* Server certificate:
* subject: CN=shop.lab
* start date: Oct 10 18:03:59 2026 GMT
* expire date: Jan 8 18:03:59 2027 GMT
* subjectAltName: host "shop.lab" matched cert's "shop.lab"
* issuer: CN=Lab Issuing CA
* SSL certificate verify ok.
openssl s_client -connect shop.lab:443 -servername shop.lab shows the chain as the server sent it, one entry per
certificate with its subject (s:) and issuer (i:). openssl x509 -noout -text decodes a certificate file,
and openssl req makes a key and a certificate signing request.
What goes wrong, and how you see it
Every certificate warning is one check failing. curl reports them all with exit code 60:
curl: (60) SSL certificate problem: unable to get local issuer certificate
curl: (60) SSL certificate problem: certificate has expired
curl: (60) SSL: no alternative certificate subject name matches target hostname 'staging.lab'
curl: (60) SSL certificate problem: self-signed certificate
Unable to get local issuer certificate most often means the server sends its certificate without the intermediate. Browsers that cached the intermediate elsewhere work, while curl, apps and some phones fail: the fix is to configure the full chain on the server. Expired means the renewal did not run, or the client's clock is wrong; a device with a bad clock finds every site broken. No alternative name matches is a certificate for another name, often production's copied to staging. Self-signed is a printer or router that signed its own certificate.
curl -k skips all of this. The connection is still encrypted, but to whoever answered, which protects nothing
against a machine in the middle. The
DNS spoofing city shows the check doing its job: a lie in DNS sends the laptop to the wrong
server, and TLS refuses it because that server cannot prove it holds the key.
Questions people ask
What is the difference between SSL and TLS? SSL was the protocol's name until version 3.0; TLS 1.0 succeeded it in 1999. Every SSL version and TLS 1.0 and 1.1 are deprecated. People still say "SSL certificate".
Does HTTPS hide which site I visit? It hides the path, the headers and the content. The server name still travels in clear in SNI, and DNS lookups and the server's IP address reveal it too, unless encrypted DNS and Encrypted Client Hello are used.
What is an intermediate certificate? A CA certificate between the root and the server's. Roots stay offline and sign intermediates, which sign servers' certificates, so a compromised intermediate can be revoked without replacing the root in every trust store.
Read next
- HTTP The web's request and response protocol: plain text over TCP unless wrapped in TLS.
- SNI The site name sent in the clear at the start of a TLS handshake, so the server can pick a certificate.
- Man in the middle A machine placed on the path between two parties, able to read and alter what is not protected end to end.
- DNSSEC and encrypted DNS Signed DNS answers, and DNS carried over an encrypted connection to a resolver you chose.
- Certificate chain A server's certificate, signed by an issuing CA, whose certificate a root signed: the path a client follows to someone it trusts.
- Wi-Fi security: WEP, WPA, WPA2, WPA3 How a wireless network keeps strangers off and its frames private, from broken WEP to WPA3.
- Encrypted DNS DNS questions sent inside TLS (DoT, port 853) or HTTPS (DoH, port 443), so the path cannot read or change them.
- NTP Keeping clocks right by asking other clocks, in a hierarchy of strata from a reference clock down.
- NTS Authenticating an NTP server over TLS so a spoofed or man-in-the-middle time source is refused.
- HTTP cookie A short piece of text a server gives a client, which the client sends back on every later request.
- WebSocket One connection kept open after an HTTP upgrade, where either side can send a message at any moment.
- HTTP/3 and QUIC HTTP over QUIC: a transport on UDP port 443 with TLS 1.3 built in and streams that do not block each other.
- ALPN The TLS extension in which client and server agree on the protocol to speak inside, such as h2 or http/1.1.
- SSH Encrypted remote login and commands, on TCP port 22, with passwords or keys.
- RDP Remote graphical login on TCP 3389: the client negotiates a security layer, then runs the desktop inside TLS.
- Hashing, salting and key exchange The building blocks under TLS and passwords: one-way hashes, salts, key pairs and agreeing a key in public.
- Trust store The list of root certificates a device trusts; every certificate it accepts chains to one of them.
- Self-signed certificate A certificate whose issuer is its own subject: nobody vouches for it but itself.
- Certificate signing request What a server sends a CA to get a certificate: its public key and names, signed with its private key.
- Clientless VPN Remote access through a web portal in the browser, over HTTPS, with nothing installed and no route into the network.
- API authentication How a program proves who it is to an API: a password on every request (Basic), a token it got once (Bearer), or a key.
- LDAP and directories One central tree of people and groups, which every server asks at login instead of keeping its own accounts.
- Mutual TLS TLS in which the server also asks for the client's certificate and checks it, so both ends prove who they are.
- Downgrade attack An attacker in the path makes two sides settle for a weaker protocol, version or cipher than both support, then breaks that.
- HTTPS interception Reading an HTTPS session from a box in the path by forging the server's certificate — which works only once the victim trusts the box's CA, and which certificate pinning defeats even then.
- weak TLS configuration A server with a valid certificate that still accepts obsolete protocol versions (TLS 1.0/1.1) or weak cipher suites — a configuration flaw the padlock never shows, found by enumerating what the server offers and fixed by policy, not a new certificate.
- Replay attack Resending a captured, still-valid request so the server honours it a second time — because nothing in the message ties it to a single use.
- Session hijacking Stealing a live session's identifier — a cookie read off the wire — and presenting it to the server to act as that user, without ever knowing their password.
- Data states The three places a piece of data can be: kept on a disk (at rest), travelling between machines (in transit), or held by a running program (in use). Each needs its own protection.
- Onion routing Sending traffic through three relays, wrapped in one layer of encryption per relay, so no single relay knows both who is asking and what for.