TLS (Transport Layer Security), formerly SSL, is the protocol that puts the "S" in HTTPS. It guarantees three things: Identity (You are talking to bank.com), Privacy (No one overhears), and Integrity (Data hasn't been modified).

The Certificate Authority (CA)

To trust `google.com`, you need a third party voucher.
Verisign, DigiCert, Let's Encrypt.
Your browser comes pre-installed with the Public Keys of these trusted CAs.
If `google.com` sends a digital ID card signed by DigiCert (which you trust), then you trust `google.com`.

1. Client Hello

Browser sends:
- "I support TLS 1.3 and 1.2."
- "I support these Cipher Suites (AES-256-GCM, SHA256...)."
- "Here is a random number (Client Random)."

2. Server Hello

Server replies:
- "Let's use TLS 1.3."
- "Let's use AES-256-GCM."
- "Here is my Certificate (Contains my Public Key)."
- "Here is a random number (Server Random)."

3. Certificate Verification

The browser checks the signature on the Certificate against its list of trusted CAs.
If valid, the browser extracts the Server's Public Key.
If invalid, you get the scary red "Your connection is not private" warning.

4. Key Exchange (Premaster Secret)

The browser generates a secret called the Premaster Secret.
It encrypts this secret using the Server's Public Key and sends it.
Only the Server (with the Private Key) can decrypt it.
Now both sides have the same secret! They use this to derive the final session keys for AES encryption.