Curious Minds

Clear answers to science and history questions

How SSL Works: Encryption, Handshakes, and Trust

· 5 min read · Science

SSL (Secure Sockets Layer) works by using public-key cryptography to establish a secure, encrypted connection between a client (like your browser) and a server (like a website), then using that connection to exchange data with symmetric encryption. Although SSL has been superseded by TLS (Transport Layer Security), the term "SSL" is still widely used to describe the same fundamental process: a handshake that authenticates the server, negotiates encryption algorithms, and creates a shared secret key for secure communication.

The Evolution from SSL to TLS

SSL was developed by Netscape in the mid-1990s to secure web transactions. SSL 2.0 and 3.0 had known vulnerabilities, and TLS 1.0 was introduced in 1999 as its successor. TLS 1.2 and 1.3 are the modern standards, with TLS 1.3 being the latest and most secure. Despite the name change, the term "SSL" persists in common usage, and SSL certificates are now technically TLS certificates. When you see "https://" in a URL, it indicates that the connection is secured using TLS (or historically SSL).

The core goals remain the same: confidentiality (eavesdroppers can't read the data), integrity (data can't be altered undetected), and authentication (you're talking to the real server).

How the SSL/TLS Handshake Works

The handshake is the process that establishes the secure connection. It happens in milliseconds, but involves several steps. Here's a simplified version for TLS 1.2 (TLS 1.3 is similar but faster):

  1. Client Hello: The client sends a message to the server with its supported TLS versions, cipher suites (encryption algorithms), and a random number.
  2. Server Hello: The server responds with its chosen TLS version, cipher suite, and its own random number. It also sends its digital certificate, which contains its public key and is signed by a trusted certificate authority (CA).
  3. Certificate Verification: The client checks the certificate's validity: is it expired? Is it issued by a trusted CA? Does it match the domain? If not, the browser warns you.
  4. Key Exchange: The client generates a pre-master secret, encrypts it with the server's public key, and sends it. Both parties then independently compute the same master secret (and session keys) using the random numbers and the pre-master secret.
  5. Finished: Both sides send a "Finished" message encrypted with the session key to verify the handshake succeeded.

In TLS 1.3, the handshake is streamlined to one round trip (instead of two), and key exchange uses ephemeral Diffie-Hellman, providing forward secrecy by default.

Public Key vs. Symmetric Encryption

SSL/TLS cleverly combines two types of encryption. Public-key encryption (asymmetric) uses a pair of keys: a public key that can be shared and a private key kept secret. It's used during the handshake to securely exchange a symmetric key. Symmetric encryption uses a single shared key for both encryption and decryption; it's much faster and is used for the actual data transfer. This hybrid approach gives both security and performance.

For example, when you log into a website, your password is encrypted with the symmetric session key, which was securely established using public-key cryptography.

Digital Certificates and Certificate Authorities

A digital certificate is an electronic document that binds a public key to an identity (like a domain name). It's issued by a Certificate Authority (CA), which verifies the identity and signs the certificate with its own private key. Browsers and operating systems come with a pre-installed list of trusted CA root certificates. When a server presents its certificate, the client checks the signature chain up to a trusted root.

Certificates come in different validation levels:

  • Domain Validation (DV): Verifies only that the requester controls the domain. Issued quickly, often automatically.
  • Organization Validation (OV): Verifies the organization's legal existence and identity. Takes a few days.
  • Extended Validation (EV): Requires more rigorous verification, but modern browsers no longer display the green bar that once distinguished EV certificates.

All three provide the same encryption strength; the difference is in the identity verification behind the certificate.

Common Misconceptions and Limitations

A common misconception is that SSL/TLS makes a website "safe" or "trustworthy." In reality, it only secures the connection between your browser and the server. It does not guarantee the website's content is safe, nor does it prevent the server itself from being malicious. Phishing sites can and do use HTTPS. The padlock icon means the connection is encrypted, not that the site is legitimate.

Another limitation: SSL/TLS does not hide the fact that you're connecting to a particular domain, nor does it hide the amount of data transferred. It also doesn't protect against malware on your own device or server-side vulnerabilities.

Frequently Asked Questions

What is the difference between SSL and TLS?

SSL is the older protocol; TLS is its successor. TLS 1.0 was essentially SSL 3.1, and subsequent versions (1.2, 1.3) are more secure. Today, when people say "SSL," they usually mean TLS. All modern secure connections use TLS.

How can I tell if a website uses SSL/TLS?

Look for "https://" in the URL and a padlock icon in the address bar. Clicking the padlock usually shows certificate details. However, remember that HTTPS alone doesn't guarantee the site is trustworthy.

Does SSL/TLS slow down my connection?

The initial handshake adds a small delay (a few milliseconds), but modern TLS 1.3 and session resumption minimize this. The encryption itself has negligible impact on speed with modern hardware.

What happens if a certificate expires?

Browsers will show a warning that the connection is not private, and users may be blocked from proceeding. Expired certificates undermine trust and should be renewed promptly.

Can SSL/TLS be broken?

While the protocol itself is considered secure when properly configured, vulnerabilities have been found in specific implementations (like Heartbleed) and older protocol versions. Using the latest TLS version and keeping software updated is essential.

Do I need an SSL certificate for my website?

Yes, for any site that handles logins, personal data, or payments, and increasingly for all sites. Search engines may penalize non-HTTPS sites, and browsers mark them as "not secure." Many CAs offer free DV certificates.

Conclusion

SSL/TLS is a foundational technology for internet security, enabling private and authenticated communication. Understanding its handshake, encryption methods, and the role of certificates helps demystify the padlock and reminds us that security is a chain—only as strong as its weakest link.

In this article
  1. The Evolution from SSL to TLS
  2. How the SSL/TLS Handshake Works
  3. Public Key vs. Symmetric Encryption
  4. Digital Certificates and Certificate Authorities
  5. Common Misconceptions and Limitations
  6. Frequently Asked Questions
  7. Conclusion