TLS- Transport Layer Security Explained
What TLS Actually Is
TLS stands for Transport Layer Security. It's a cryptographic protocol designed to secure communications over computer networks. You encounter it every time you see a padlock icon in your browser's address bar.
Plain and simple: TLS keeps your data private and intact while it travels between your device and a server. Without it, everything you send online—passwords, credit card numbers, private messages—travels in plain text. Anyone with the right tools can intercept and read it.
TLS is the successor to SSL (Secure Sockets Layer). SSL is dead now. Deprecated. Nobody uses it anymore. If someone tells you their site has "SSL certification," they're either lying or don't know what they're talking about. They mean TLS.
How TLS Works: The Handshake
TLS works through a process called the handshake. This happens in milliseconds every time your browser connects to a secure site. Here's what actually occurs:
- Your browser sends a "hello" message to the server, listing the TLS versions and cipher suites it supports
- The server responds with its certificate and chosen settings
- Your browser verifies the certificate against trusted Certificate Authorities (CAs)
- Your browser generates a session key, encrypts it with the server's public key, and sends it
- Both sides now have the same session key and can encrypt/decrypt data
- Secure communication begins
The handshake typically takes one to three round trips. With TLS 1.3, this was reduced to a single round trip, making connections noticeably faster.
Symmetric vs Asymmetric Encryption
TLS uses two types of encryption. During the handshake, asymmetric encryption handles the key exchange—your browser and the server use different keys for encrypting and decrypting. Once the session key is established, both sides switch to symmetric encryption, which is faster and uses the same key for both directions.
This hybrid approach gives you the security of public key cryptography during setup and the speed of symmetric encryption for actual data transfer.
TLS Versions: What You Need to Know
Several TLS versions exist. Here's the brutal breakdown:
| Version | Status | Notes |
|---|---|---|
| TLS 1.0 | Deprecated | Has known vulnerabilities. Don't use it. |
| TLS 1.1 | Deprecated | Same story. Dead technology. |
| TLS 1.2 | Widely supported | Secure enough for now. Most servers still use it. |
| TLS 1.3 | Current standard | Faster, more secure. You want this. |
PCI-DSS compliance requires at least TLS 1.1, but honestly, you should only accept TLS 1.2 or 1.3. TLS 1.0 and 1.1 have known weaknesses that attackers can exploit. Browsers are already dropping support for these older versions.
What TLS Actually Protects Against
TLS isn't magic. It has limits. Here's what it does and doesn't do:
- What it protects: Data in transit between your device and the server. Nobody can read your traffic even if they intercept it.
- What it protects: Data integrity. Attackers can't modify your data without detection.
- What it doesn't protect: Data stored on servers. If a database gets breached, TLS won't help.
- What it doesn't protect: Client-side code. JavaScript malware still runs in your browser.
- What it doesn't protect: Metadata. Observers can still see that you're connecting to example.com, even if they can't read the content.
TLS protects the pipe, not the endpoints. Keep that distinction clear.
Certificates: The Trust Chain
TLS relies on digital certificates to verify server identity. These certificates form a trust chain:
- A root Certificate Authority (CA) is pre-installed in browsers and operating systems
- Intermediate CAs are signed by roots and sign server certificates
- Server certificates are signed by intermediates
When your browser connects to a site, it verifies the certificate chain all the way back to a trusted root. If anything breaks in this chain, you get a certificate error.
Common Certificate Problems
Certificate errors happen. Here's why:
- Expired certificate: Certificates expire. CAs typically issue them for 1-2 years. If a site owner forgot to renew, you see a warning.
- Wrong domain: The certificate was issued for example.com but you're visiting www.example.com. Mismatch error.
- Self-signed certificate: A site using a certificate it signed itself. Browsers don't trust these by default.
- Revoked certificate: The CA revoked the certificate, usually because the private key was compromised.
Don't ignore certificate warnings. Clicking through them means you're trusting an unverified identity.
TLS 1.3 vs TLS 1.2: The Differences
TLS 1.3 isn't just a version bump. It has real improvements:
| Feature | TLS 1.2 | TLS 1.3 |
|---|---|---|
| Handshake round trips | 2 | 1 |
| Handshake time | 100-300ms | 50-100ms |
| Supported cipher suites | Many (including weak ones) | 5 mandatory |
| 0-RTT resumption | Optional | Supported |
| RSA key exchange | Allowed | Removed |
The biggest change: TLS 1.3 removed support for RSA key exchange and static RSA certificates. Now only ephemeral Diffie-Hellman key exchange is used. This provides forward secrecy—if a server's private key gets compromised, past sessions remain secure.
TLS 1.3 also cleaned up the cipher suite mess. TLS 1.2 had dozens of options, many of them weak. TLS 1.3 standardized on five strong cipher suites. No more negotiating weak algorithms.
Where TLS Is Used
TLS shows up everywhere you need secure communication:
- HTTPS: The obvious one. HTTP over TLS. Every secure website uses it.
- Email: IMAPS, POP3S, and SMTPS use TLS to protect email in transit.
- VPNs: Most VPN protocols run over TLS.
- Messaging apps: Signal, WhatsApp, and others use TLS for transport security.
- API connections: Mobile apps and single-page applications typically connect to APIs over TLS.
If you're building anything that sends sensitive data over a network, you need TLS. No exceptions.
Getting Started: Implementing TLS
Here's how to actually implement TLS on your servers and applications:
Server-Side Configuration
For nginx, a basic TLS configuration looks like:
server {
listen 443 ssl http2;
ssl_certificate /path/to/certificate.crt;
ssl_certificate_key /path/to/private.key;
ssl_protocols TLSv1.2 TLSv1.3;
ssl_ciphers 'TLS_AES_256_GCM_SHA384:TLS_CHACHA20_POLY1305_SHA256:TLS_AES_128_GCM_SHA256';
ssl_prefer_server_ciphers on;
ssl_session_timeout 1d;
ssl_session_cache shared:SSL:10m;
}
For Apache:
<VirtualHost *:443>
SSLEngine on
SSLCertificateFile /path/to/certificate.crt
SSLCertificateKeyFile /path/to/private.key
SSLProtocol all -SSLv3 -TLSv1 -TLSv1.1
SSLCipherSuite ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256
</VirtualHost>
Getting a Certificate
You have three options:
- Let's Encrypt: Free, automated, and widely trusted. Best choice for most websites. Uses ACME protocol for automatic renewal.
- Commercial CAs: DigiCert, Sectigo, GlobalSign. You pay for extended validation certificates and warranty protection.
- Self-signed: Only for internal development. Browsers will warn users. Never use in production.
Testing Your Configuration
Use SSL Labs SSL Test (ssllabs.com/ssltest) to check your TLS configuration. It gives you a letter grade and lists every supported cipher, protocol version, and known vulnerability.
Also run:
openssl s_client -connect example.com:443 -tls1_3
This tests a specific TLS version connection. If it succeeds, that version is working.
TLS Performance Tips
TLS adds latency. Here's how to minimize it:
- Enable TLS 1.3: Single round-trip handshake is faster.
- Use session resumption: Session tickets or session IDs let clients resume previous sessions without a full handshake.
- Enable OCSP stapling: Your server includes certificate revocation status in the handshake, saving a DNS lookup and HTTP request.
- Use HTTP/2: Multiplexes multiple requests over a single connection, reducing handshakes.
- Deploy close to users: CDN edge servers terminate TLS closer to users.
The Bottom Line
TLS is non-negotiable for any production system. It's not optional security theater—it's the baseline for anything that touches the internet. Use TLS 1.2 minimum, preferably TLS 1.3. Get certificates from Let's Encrypt unless you have specific reasons not to. Test your configuration regularly.
Skip the "best practices" listicles that tell you to use 47 different headers and configure 12 cipher suites. Start with a clean TLS 1.3 configuration, enable HTTP/2, and move on.