Why Your Website Needs HTTPS: Encryption Basics and the TLS Handshake
Open any bank or e-commerce site and you will see a small padlock in the address bar, with the address starting in https://. What does that padlock mean? HTTP and HTTPS differ by one letter, yet their security levels are worlds apart. This article uses everyday analogies to explain encryption, the TLS handshake, and certificates.
1. HTTP vs HTTPS
HTTP is the protocol browsers and servers use to transfer data, and it is not encrypted: passwords, orders, and ID numbers travel as plaintext on the network, readable by any router in between — like mailing a postcard. The mail carrier can read it, and so can every relay station.
HTTPS = HTTP + TLS (Transport Layer Security). It adds an encryption layer. Comparison:
| Aspect | HTTP | HTTPS |
|---|---|---|
| Transport | Plaintext, readable | Encrypted, unreadable if intercepted |
| Default port | 80 | 443 |
| Identity verification | None | Certificates verify the server |
| Tampering | Easy | Extremely hard |
| Modern browsers | Marked "Not Secure" | Shows a padlock |
In short, HTTPS solves three problems at once: confidentiality (encryption), integrity (anti-tampering), and authentication (anti-impersonation).
2. Symmetric Encryption: One Shared Key
Symmetric encryption is the most intuitive form: the sender and receiver use the same key to encrypt and decrypt, like two people sharing one lock.
Its strength is speed, which makes it ideal for large amounts of data. Its weakness is the "key exchange" problem: if you send the key over the network, the key itself can be stolen, and the encryption becomes meaningless. It is a chicken-and-egg problem.
3. Asymmetric Encryption: The Mailbox
Asymmetric encryption uses a key pair: a public key that can be shared and a private key that must stay secret. Data encrypted with the public key can only be decrypted with the private key.
Think of a mailbox: anyone can drop a letter through the public slot (the public key), but only you can open the box with your key (the private key). Anyone can send in, but only you can read it.
Asymmetric encryption solves the key-exchange problem but is computationally expensive and slow, so it is not suited to large payloads. The real-world solution combines both.
4. The TLS Handshake (Simplified): Four Steps to an Encrypted Conversation
The full handshake is complex, but the core logic fits into four steps:
- Hello: the browser sends a "hello" listing the cipher suites it supports and a random number;
- Show the certificate: the server sends back its digital certificate (containing its public key and identity);
- Verify + exchange keys: the browser verifies the certificate was issued by a trusted CA and matches the domain, then generates a random number (the session key for symmetric encryption) and encrypts it with the server's public key;
- Talk: the server decrypts with its private key, both sides confirm, and all subsequent data is encrypted symmetrically with that session key.
The whole process is invisible to the user and typically completes in around 100 ms. Just remember the takeaway: after the handshake, data is encrypted symmetrically (fast), and the symmetric key itself was safely delivered using asymmetric encryption (solving the key-exchange problem).
5. What Certificates Do: ID Card + Vault
A certificate is the linchpin of HTTPS security. It does two jobs: proving "who I am" (identity) and providing the public key (encryption).
Certificates are issued by Certificate Authorities (CAs), and browsers ship with a list of trusted CAs. When a server presents a certificate, the browser checks whether the issuer is trusted, whether the certificate is expired, and whether the domain matches. Failure on any check triggers a warning. For choosing DV/OV/EV and single/wildcard/multi-domain types, see SSL Certificate Types Guide.
6. How to Put Your Site on HTTPS
For personal sites, the cheapest path is a free Let's Encrypt certificate (valid 90 days) with automatic renewal:
- Install a tool like Certbot on the server;
- Point your domain's DNS at the server;
- Run the command to obtain and deploy the certificate, and redirect port 80 to 443;
- Set up a scheduled task for automatic renewal.
Step-by-step instructions: Let's Encrypt SSL Setup Guide. If your site sits behind a CDN, certificate setup differs slightly — see CDN and HTTPS Configuration Basics. For migrating an entire site from HTTP to HTTPS, see Website HTTPS Migration Guide.
- Are free certificates reliable:Yes. Let's Encrypt DV certificates have the same security strength as paid DV certificates. The differences are stronger validation options, longer validity, and human support that paid certificates offer.
- Why does my browser still warn on my HTTPS site:Common causes: expired certificate, domain mismatch, incomplete certificate chain, or mixed content (HTTP resources inside an HTTPS page). Check them one by one.
- Does HTTPS slow down my site:Negligibly. The handshake adds only tens of milliseconds, and modern HTTP/2 and HTTP/3 actually make things faster. The benefits far outweigh the cost.
- Can I still run an HTTP-only site:Technically yes, but every major browser marks it "Not Secure", login and payment features are hindered, and SEO suffers. Migrate as soon as possible.
8. Summary
One line: HTTPS uses asymmetric encryption to deliver the key safely, symmetric encryption to move data fast, and certificates to verify identity — together covering the three risks of eavesdropping, tampering, and impersonation. To learn more about security, bookmark the Security & SSL category.
Configuration & Integration Examples
Example 1: Complete a handshake by hand and inspect the chain
# -servername is required, otherwise you get the default vhost certificate
openssl s_client -connect www.example.com:443 \
-servername www.example.com -showcerts </dev/null 2>/dev/null \
| openssl x509 -noout -subject -issuer -dates
# When only the negotiated result matters, grep these fields
openssl s_client -connect www.example.com:443 -servername www.example.com </dev/null 2>/dev/null \
| grep -E 'Protocol|Cipher|Verify return code'
# A missing intermediate certificate breaks some clients; reproduce it with -CAfile
openssl s_client -connect www.example.com:443 -servername www.example.com \
-CAfile /etc/ssl/certs/ca-certificates.crt </dev/null 2>/dev/null | grep 'Verify return code'
A non-zero verify code means the chain is broken, which is exactly what users see as not secure.
Example 2: Check expiry and whether automatic renewal really works
# 1) Expiry timestamp (UTC)
echo | openssl s_client -connect www.example.com:443 -servername www.example.com 2>/dev/null \
| openssl x509 -noout -enddate
# 2) Full handshake via curl to confirm there is no downgrade to old protocols
curl -vI https://www.example.com/ 2>&1 | grep -E 'SSL connection|TLSv|subject:|expire date'
# 3) Also confirm HSTS is on, otherwise the first visit can still be downgraded
curl -sI https://www.example.com/ | grep -i 'strict-transport-security'
# 4) Renewal rehearsal: issue nothing, just verify hooks and challenge methods
sudo certbot renew --dry-run
Wire --dry-run into routine checks a month before expiry instead of firefighting after it.
Certificate Chain, Hostname and Mixed Content: Three Ways to Locate an HTTPS Error
When a browser flags a site as not secure, the three checks run in a fixed order: whether the chain validates to a trusted root, whether the certificate matches the hostname and date, and whether the page still loads HTTP resources. Doing it in the opposite order means chasing mixed content while the real fault is a missing intermediate certificate.
Validate the chain with openssl s_client -connect host:443 -servername host -showcerts; only a Verify return code of 0 passes. Re-running with -CAfile tells you whether the server omits an intermediate or the local root store is stale. Protocol and cipher come from the Protocol and Cipher lines of the same output, and the SSL connection line from curl -vI https://host/ confirms no deprecated version was negotiated.
| Symptom | Usual cause | Command to check | Direction |
|---|---|---|---|
Non-zero Verify return code |
Intermediate certificate not served, or a stale local root store | openssl s_client -showcerts with -CAfile |
Complete the chain on the server side |
| Browser reports a hostname mismatch | Certificate SAN does not cover the hostname in use | openssl x509 -noout -subject -dates |
Reissue a certificate covering that hostname |
| Browser reports an expired certificate | Automatic renewal failed before the 90-day limit | openssl s_client piped to x509 -noout -enddate |
Run certbot renew --dry-run to test hooks |
| Padlock fine but mixed-content warnings appear | Images, scripts or styles still loaded over http:// |
The security warnings list in the browser console | Move resources to HTTPS |
Limitations
- Asymmetric encryption uses a key pair: a public key that can be shared and a private key that must stay secret.
- This article reflects public information as of 2026-08-12; terms, prices and quotas follow the provider's current published terms.
- Third-party capability and limit statements follow their official documentation; no further commitment is implied here.
- Licensing, filing and data-residency decisions must be verified against the regulations of your operating region.
FAQ
What are the prerequisites for enabling HTTPS?
You need both 80 and 443 open before anything else. A free Let's Encrypt certificate lasts 90 days, and the domain must already resolve to that server so the validation port is reachable; afterwards redirect 80 to 443 and replace leftover http links, or browsers keep flagging the page.
The chain is incomplete - what's the troubleshooting order?
Check the chain, the expiry date, then the hostname. Run openssl s_client with -showcerts to see whether an intermediate certificate is missing, since a non-zero Verify return code means a broken chain. Then confirm the end date, pass -servername for SNI, and finally hunt for mixed http resources.
Where should the private key and session key live?
The private key stays on the server and is never transmitted. The browser generates the session key, encrypts it with the public key inside the certificate, and only the private key can decrypt it, while certificate and public key are distributed freely; the handshake itself usually finishes in about 100 milliseconds.
Related Providers
- Let's Encrypt: when DV certificates are enough and an ACME client already renews them on a schedule.
- DigiCert: when OV or EV certificates must carry organization details in the subject for customers to verify.
- Cloudflare SSL: when TLS should terminate at the edge and the origin trusts only an Origin CA certificate.
Community & Resources
Official docs and communities
- RFC 8446 · TLS 1.3 — Handshake flow and cipher suite specification
- MDN · TLS — Certificate chains, handshakes, and common misconfigurations
- Let's Encrypt docs — Issuance flow, rate limits, and validation methods
- openssl s_client — Manual handshake and certificate chain inspection
Learning resources and tools
- SSL Labs test — Grade and protocol support check for a public endpoint
- OWASP · TLS cheat sheet — Baseline for protocol versions, suites, and HSTS
- Certbot instructions — Pick the install path for your server and OS
- Stack Overflow · ssl — Troubleshooting chains and handshake failures
Original source: 16IDC Original ↗