How HTTPS and TLS Actually Work
How HTTPS and TLS Actually Work
Every time you visit a website with a padlock icon, TLS is working behind the scenes. But most developers never look beyond that padlock. Understanding how HTTPS and TLS actually function is essential for building secure applications, debugging connectivity issues, and making informed decisions about certificates and encryption.
This article demystifies the TLS handshake, explains the certificate chain of trust, covers the cryptographic keys involved, and shows you how to inspect and verify certificates using hands-on tools.
What Is HTTPS?
HTTPS is simply HTTP encrypted with TLS:
HTTP = Application data in plaintext
HTTPS = HTTP + TLS encryption layer
When you type https://bestwordz.com in your browser:
1. DNS resolves the domain to an IP address
2. TCP connection is established (port 443)
3. TLS handshake happens (this article)
4. Encrypted HTTP requests/responses flow
5. Connection closes
Without TLS, everything is visible: your passwords, session tokens, search queries, and browsing history. With TLS, an eavesdropper sees only encrypted gibberish.
The Three Pillars of TLS
| Pillar | Purpose | Mechanism |
|---|---|---|
| Confidentiality | Keep data secret from eavesdroppers | AES-256-GCM encryption with session keys |
| Integrity | Detect any tampering with data | HMAC authentication tags on every record |
| Authentication | Verify the server is who it claims to be | X.509 certificates signed by trusted CAs |
The TLS 1.3 Handshake
TLS 1.3 is the current standard (RFC 8446, 2018). It completed the handshake in just 1 round-trip — down from 2 round-trips in TLS 1.2. Here is what happens:
Step 1: ClientHello
The browser initiates the handshake by sending its supported options:
ClientHello contains:
├── TLS version: "I support TLS 1.3"
├── Cipher suites: [AES-256-GCM, ChaCha20-Poly1305, ...]
├── Key share: my ECDHE public key (X25519)
├── SNI: "bestwordz.com" (which domain I want)
└── Extensions: ALPN (h2 for HTTP/2), supported groups
The key share is critical: the client generates a temporary ECDHE key pair and sends its public key. This enables 1-RTT because the server can immediately compute the shared secret.
Step 2: ServerHello + Certificate
The server responds with its chosen parameters and identity:
ServerHello contains:
├── Chosen cipher suite: AES-256-GCM-SHA384
├── Key share: my ECDHE public key
├── Certificate: my X.509 certificate chain
├── CertificateVerify: signature over handshake transcript
└── Finished: MAC of entire handshake
The server's CertificateVerify message proves it owns the private key matching the certificate's public key. This is how authentication works — the server signs the entire handshake transcript with its private key.
Step 3: Key Derivation
Both sides now compute shared secrets without ever transmitting them:
1. ECDHE key exchange:
Client private × Server public = Shared secret
Server private × Client public = Same shared secret
2. HKDF key derivation:
Shared secret → Handshake traffic keys
Shared secret → Application traffic keys
3. Encryption begins:
Each direction gets its own AES-256-GCM key
Client-to-server and server-to-client are independent
Try it yourself: Use the Diffie-Hellman Demo to see how two parties can agree on a shared secret over an insecure channel. Then try the ECDH Key Agreement tool for the elliptic-curve variant used in modern TLS.
Certificates: The Chain of Trust
TLS authentication relies on X.509 certificates — digital documents that bind a domain name to a public key. But how does your browser know the certificate is legitimate? Through a chain of trust.
What's Inside a Certificate?
X.509 Certificate:
├── Subject: bestwordz.com
├── Issuer: Let's Encrypt Authority X3
├── Public Key: RSA 2048-bit or ECDSA P-256
├── Valid From: 2026-01-01
├── Valid Until: 2026-04-01
├── Serial: 04:a3:b2:c1:d5:e6...
├── Extensions:
│ ├── Subject Alternative Names: bestwordz.com, www.bestwordz.com
│ ├── Key Usage: Digital Signature, Key Encipherment
│ └── Basic Constraints: CA:FALSE
└── Signature: SHA-256 with RSA (by issuer)
Inspect any certificate: Use the Certificate Decoder to paste any PEM certificate and see all its fields. Or use the X.509 Certificate Viewer for detailed inspection.
How Certificate Verification Works
When your browser receives a server certificate, it performs these checks:
- Chain validation: Is the certificate signed by a trusted intermediate CA? Is that intermediate signed by a trusted root CA?
- Validity dates: Is the current date between the "Not Before" and "Not After" dates?
- Domain match: Does the certificate's Subject Alternative Name (SAN) match the domain you're visiting?
- Revocation check: Has the certificate been revoked? (CRL or OCSP)
- Key usage: Is the certificate authorized for TLS server authentication?
If any check fails, the browser shows a security warning and refuses to connect.
Symmetric vs Asymmetric Keys in TLS
TLS uses both types of cryptography, each for a different purpose:
| Purpose | Algorithm | When Used |
|---|---|---|
| Key exchange | ECDHE (asymmetric) | During handshake only |
| Authentication | RSA/ECDSA signature (asymmetric) | Certificate verification |
| Data encryption | AES-256-GCM (symmetric) | All application data |
| Data integrity | HMAC / AEAD (symmetric) | Every encrypted record |
Try it: Use the Symmetric vs Asymmetric Demo to see why TLS uses asymmetric crypto for key exchange but symmetric crypto for bulk data. Generate keys with the RSA Key Pair Generator or ECDSA Key Generator.
Certificate Authorities (CAs)
A Certificate Authority is an organization trusted by operating systems and browsers to sign certificates. The major CAs include:
| CA | Type | Notes |
|---|---|---|
| Let's Encrypt | Free, automated | 90-day certs, most popular free CA |
| DigiCert | Commercial | Enterprise, extended validation |
| Cloudflare | Free with CDN | Automatic certificate management |
| ZeroSSL | Free tier available | ACME-compatible, 90-day certs |
You can verify any SSL certificate with the SSL Certificate Checker. Check expiry with the Certificate Expiry Checker.
TLS 1.2 vs TLS 1.3
TLS 1.3 (2018) made significant improvements over TLS 1.2 (2008):
| Feature | TLS 1.2 | TLS 1.3 |
|---|---|---|
| Handshake rounds | 2 RTT | 1 RTT |
| 0-RTT resumption | No | Yes (with replay risks) |
| Forward secrecy | Optional | Mandatory |
| RSA key exchange | Supported | Removed (insecure) |
| Cipher suites | Many (including weak) | 5 secure suites only |
| Encryption in handshake | Mostly plaintext | Encrypted earlier |
Try RSA encryption: Use the RSA-OAEP Encrypt tool to see why RSA key exchange was removed — it doesn't provide forward secrecy.
Forward Secrecy Explained
Forward secrecy (also called perfect forward secrecy or PFS) ensures that even if a server's private key is compromised in the future, past sessions cannot be decrypted.
With forward secrecy (ECDHE):
Each session uses a unique temporary key pair. Compromising the server's long-term certificate key cannot decrypt past sessions because the session keys were derived from ephemeral keys that were discarded.
Without forward secrecy (RSA key exchange):
The client encrypts the pre-master secret with the server's RSA public key. If the server's private key is later stolen, all past sessions encrypted with that key can be decrypted. This is why TLS 1.3 removed RSA key exchange entirely.
Common TLS Configurations
# Nginx TLS configuration (modern)
ssl_protocols TLSv1.2 TLSv1.3;
ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384;
ssl_prefer_server_ciphers on;
ssl_session_timeout 1d;
ssl_session_cache shared:SSL:10m;
ssl_stapling on;
ssl_stapling_verify on;
# Security headers
add_header Strict-Transport-Security "max-age=63072000; includeSubDomains; preload" always;
Analyze headers: Use the Security Headers Analyzer to check your site's security headers. Generate HSTS with the HSTS Header Generator. Build a CSP with the CSP Builder.
Debugging TLS Issues
Common TLS problems and how to diagnose them:
| Problem | Cause | Fix |
|---|---|---|
| "Certificate expired" | Not After date passed | Renew certificate |
| "Certificate name mismatch" | Domain not in SAN | Add domain to certificate |
| "ERR_SSL_VERSION_OR_CIPHER_MISMATCH" | Old TLS or weak cipher | Enable TLS 1.2+, modern ciphers |
| "SSL certificate problem: unable to get local issuer" | Missing intermediate cert | Send full certificate chain |
| "certificate verify failed" | Self-signed or untrusted CA | Use a trusted CA certificate |
Inspect certificates: Use the Certificate Inspector for detailed analysis, the Certificate Fingerprint tool to compute SHA-256 fingerprints, and the URL Security Analyzer to check any URL's TLS configuration.
Certificate Management Tools
Working with certificates in development or production? These tools help:
Certificate Inspection
- Certificate Decoder — Decode any PEM certificate and see all fields
- X.509 Certificate Viewer — Detailed certificate inspection
- Certificate Inspector — Analyze certificate chain and trust
- Certificate Expiry Checker — Check when certificates expire
- Certificate Fingerprint — Compute SHA-256 fingerprints
- SSL Certificate Checker — Verify any SSL certificate
Key Generation
- RSA Key Pair Generator — Generate RSA public/private keys
- ECDSA Key Generator — Generate elliptic curve keys
- AES Key Generator — Generate symmetric encryption keys
Certificate Format Conversion
- PEM Decoder — Decode PEM-encoded certificates and keys
- PEM Encoder — Encode data to PEM format
- PEM to DER — Convert PEM to DER binary format
- DER to PEM — Convert DER to PEM text format
- CSR Generator — Create Certificate Signing Requests
- CSR Decoder — Decode Certificate Signing Requests
Key Exchange & Signatures
- Diffie-Hellman Demo — See key exchange in action
- Diffie-Hellman Visual — Visual key exchange simulation
- ECDH Key Agreement — Elliptic curve key exchange
- Digital Signature Demo — See how certificates are signed
- RSA-PSS Sign — Create RSA signatures
- RSA-PSS Verify — Verify RSA signatures
- ECDSA Sign — Create ECDSA signatures
- ECDSA Verify — Verify ECDSA signatures
TLS Security Checklist
✅ Minimum TLS configuration for production:
- ✓ Enable TLS 1.2 and TLS 1.3 (disable TLS 1.0 and 1.1)
- ✓ Use ECDHE key exchange (forward secrecy)
- ✓ Prefer AES-256-GCM or ChaCha20-Poly1305
- ✓ Send the full certificate chain (including intermediates)
- ✓ Set up certificate auto-renewal (Let's Encrypt + certbot)
- ✓ Enable HSTS with long max-age
- ✓ Enable OCSP stapling
- ✓ Use strong key sizes (RSA 2048+ or ECDSA P-256+)
- ✓ Monitor certificate expiry
- ✓ Use the Security Headers Analyzer to verify
Conclusion
HTTPS is not a single technology — it is a carefully orchestrated sequence of cryptographic operations. The TLS handshake negotiates algorithms, exchanges keys via ECDHE, authenticates the server via X.509 certificates, and derives symmetric session keys — all in about 100 milliseconds.
Understanding this process helps developers debug certificate issues, configure secure servers, choose the right certificate type, and build applications that protect user data by default. The padlock icon represents an enormous amount of engineering — now you know what's behind it.
Related BestWordz Resources
- Hashing vs Encryption vs Encoding — Understanding the crypto building blocks TLS uses
- Symmetric vs Asymmetric Demo — Why TLS uses both types of encryption
- Hashing vs Encryption vs Encoding Demo — Interactive comparison of all three
- AI Security Risks — Securing AI agents with TLS and certificates
- MCP Security Checklist — TLS requirements for MCP servers
- Protecting API Keys and Secrets — TLS is the first line of defense
💬 Discuss this topic
Have questions or insights about How HTTPS and TLS Actually Work? Join the BestWordz Community.
📚 Related Articles
The 8-Stage Cybersecurity Roadmap
Cybersecurity in 2026 requires a layered learning path: networking fundamentals, Linux proficiency,…
CybersecurityIs AI-Generated Code Secure? A Developer Security Checklist
Key Takeaway AI-generated code is not automatically secure. LLMs produce syntactically …
CybersecurityHashing vs Encryption vs Encoding: What's the Difference?
Key Takeaway --> Hashing verifies integrity and stores passwords safely. Encryption keeps data con…
CybersecurityThe 10-Stage CS Learning Roadmap
A computer science education in 2026 requires more than traditional coursework. Today's students ne…
CybersecurityAPI Authentication Methods Compared
Key Takeaway --> There is no single "best" API authentication method. API keys are simple but weak…
CybersecurityThe 15 AI Security Domains
AI security is not one problem — it is 15 interconnected domains. From prompt injection to sandboxi…
🔧 Related Tools
AES-256-GCM Encrypt
Encrypt text with AES-256-GCM - the recommended encryption standard.
Try it now →AES Key Generator
Generate cryptographically secure AES-128, AES-192, or AES-256 keys.
Try it now →Diffie-Hellman Demo
Educational demonstration of classic Diffie-Hellman key exchange.
Try it now →ECDH Key Agreement
Derive a shared secret using Elliptic Curve Diffie-Hellman.
Try it now →💬 Discuss on BestWordz Community
Join the conversation about LLMs, MCP, AI Agents on the BestWordz Community forum.
Visit Forum →