What is a digital certificate, and how does a browser verify it?
MediumConceptTLS, Firewalls & Load Balancers
Answer
A digital certificate (X.509 format) binds a public key to an identity such as a domain name, and is signed by a certificate authority (CA), a trusted organisation that checks who controls the domain. It lets the browser trust that the public key it receives really belongs to the site it meant to visit, which defeats man-in-the-middle attacks.
When a site presents its certificate, the browser checks that:
- the chain of trust leads through intermediate CAs to a root CA already in the browser's or operating system's trust store, and every signature in the chain is valid;
- the domain in the address bar matches a name in the certificate, and the current date lies within its validity period;
- the certificate has not been revoked.
If any check fails, the browser shows a security warning instead of the page.
Example: A certificate chain for a sample site:
www.example.com leaf: the site's public key, signed by the intermediate
└─ Example Issuing CA intermediate: signed by the root
└─ Example Root CA root: pre-installed in the browser's trust store
An attacker can create a certificate claiming to be www.example.com, but no trusted CA will sign it, so verification fails.