X.509 Certificate Path Validation
X.509 certificate path validation is the process of proving that a server certificate leads through trusted certificates to a root your system accepts, and that it is valid for the server name you requested.
The problem it solves
A certificate binds a public key to an identity claim. In HTTPS, the server presents a certificate saying, in effect, “this public key represents api.example.com.” The certificate is digitally signed by another certificate’s private key so that an issuer can make that claim verifiable.
Without path validation, a client would have no reliable way to decide which signatures to trust. Anyone could create a certificate containing api.example.com and sign it with their own key. The signature would be mathematically valid, but it would not be a statement from an authority the client trusts.
Operating systems, browsers, and runtimes therefore ship or configure trust anchors: usually root CA certificates, where CA means certificate authority. A root is trusted because it is installed as trusted configuration, not because the network proved that it is trustworthy during this connection.
The chain from leaf to root
The server certificate is called the leaf certificate because it describes the endpoint at the end of the chain. It normally contains:
- the server’s public key;
- the names for which the key may be used;
- a validity period;
- an issuer name; and
- a signature made by an issuing CA.
The server commonly sends the leaf plus one or more intermediate certificates. An intermediate is a CA certificate signed by another CA. The client supplies the final root from its local trust store; servers generally do not need to send roots.
A typical path looks like this:
server certificate
↓ signed by
intermediate CA
↓ signed by
trusted root CA
The client builds this path by finding a certificate whose public key can verify the leaf’s signature, then finding the issuer of that certificate, and continuing until it reaches a configured trust anchor. It can use the certificates sent by the server and certificates already available locally. Some platforms can also retrieve missing intermediates, but an application should not assume that network retrieval will work.
The issuer and subject names, and fields such as authority key identifier (a hint about the issuer key) help with this search. They are not themselves proof. A candidate issuer must also have a matching public key and produce a valid signature. There may be several possible paths, including paths through different intermediate CAs, so “the chain” is a path selected from a certificate graph rather than a fixed list.
Verifying the path
After finding a candidate path, the client validates each certificate and the relationships between them. The central cryptographic operation is signature verification: the issuer’s public key must verify the signature over the child certificate’s contents. This detects a changed certificate and demonstrates that the issuer’s private key signed it.
The client also checks the following, subject to its platform and application policy:
- Validity time: the current time must fall between each certificate’s
notBeforeandnotAftervalues. Clock errors can therefore look like certificate failures. - Issuer relationship: each certificate must be issued by the next certificate in the path, with compatible names and keys.
- CA permission: an intermediate must have the
basicConstraintsextension marking it as a CA. ItskeyUsagemust permit certificate signing when that restriction is present. - Path length: a CA can limit how many further intermediate CAs may appear below it. This is the
pathLenConstraintpart ofbasicConstraints. - Name constraints: an intermediate can restrict the DNS names, IP ranges, or other names that subordinate certificates may contain.
- Allowed algorithms: policy may reject obsolete signature algorithms, weak keys, or unacceptable parameters even if the raw signature verifies.
- Critical extensions: a certificate extension marked critical must be understood and obeyed. Ignoring an unknown critical restriction would make validation unsafe.
- Leaf usage: the leaf’s key usage and extended key usage must allow the intended operation. For HTTPS this commonly includes the
serverAuthextended key usage.
The root is special. The configured trust anchor is the point where the client stops asking “who signed this?” It may be represented by a complete root certificate or by trusted key and name information, and its self-signature is not what creates trust. A self-signed certificate merely signs itself; being installed as a trust anchor is the important decision.
Path validation is therefore stronger than checking that a chain of signatures exists. A perfectly signed chain can still fail because an intermediate is not allowed to issue certificates, the certificate is expired, or the requested use is prohibited.
Checking the requested hostname
Successful path validation proves that a trusted authority signed the server’s public key. It does not prove that the key belongs to the hostname in the URL. The client performs a separate identity check against the requested host.
For a DNS name such as api.example.com, the client normally reads the certificate’s Subject Alternative Name (SAN) extension and looks for a matching dNSName entry. Matching is based on hostname rules, not on arbitrary substring comparison. A wildcard such as *.example.com normally matches one label, such as api.example.com, but not a.b.example.com or example.com itself.
If the URL contains an IP address, the certificate needs an IP-address SAN containing that address. An IP address written as a DNS name is not equivalent. Modern clients generally do not use the certificate’s older Common Name field as a fallback when SAN is absent, although compatibility behavior varies.
This check also uses the client’s interpretation of the requested hostname, including its normalization and handling of internationalized names. A certificate can therefore have a valid chain and still fail with an error such as “hostname mismatch.”
What TLS adds
During a TLS handshake, the server also proves possession of the private key corresponding to the leaf certificate’s public key by signing handshake data. Path validation establishes that the public key is authorized for the identity; the handshake signature establishes that the connected server actually controls the matching private key.
Certificate revocation is another related but distinct check. Clients may consult CRLs, which are certificate revocation lists, or OCSP, a protocol for asking whether a certificate has been revoked. Whether and how those checks run depends on the platform and policy; a valid path does not automatically mean revocation status was checked.
When a connection fails with messages such as unable to get local issuer certificate, certificate verify failed, unknown CA, expired certificate, or hostname mismatch, the message usually identifies which part failed: path construction, signature or constraint validation, trust-anchor selection, time validation, or the final hostname check. The error is not necessarily saying that the server sent no certificate; it may have sent a chain that does not reach a root trusted by this particular client.