Lesson 5 of 7 · 10 min read
PKI and Certificate Chains
In this lesson
TL;DR: A certificate says "this public key belongs to this name", signed by a certificate authority (CA). Your device ships with a set of trusted root CAs. A server presents its leaf certificate plus intermediates, and the client builds a chain up to a trusted root, checking at each link the signature, the validity dates, that issuers are allowed to issue (basic constraints), and that the leaf's name matches the host. Certificate Transparency logs make every publicly trusted certificate visible so mis-issuance can be caught. Revocation exists but is unreliable, which is why certificate lifetimes keep shrinking.
Before you read
Pick an answer before you read further. The lesson below explains it, and guessing first, right or wrong, helps the explanation stay with you.
1A developer's HTTPS client trusts a server because the certificate's signature is valid and it has not expired. What check is missing that lets an attacker with a valid certificate for evil.example impersonate bank.example?
The problem PKI solves
Signatures and key exchange work only if you have the right public key. On the web you connect to servers you have never seen, so you need a way to learn a server's public key from a source you already trust. Public key infrastructure is that source: a set of authorities, policies and data formats for vouching that a public key belongs to a name.
What a certificate contains
An X.509 certificate is a signed data structure. The fields that matter most for validation:
| Field | Meaning |
|---|---|
| Subject Alternative Name (SAN) | The DNS names (or IP addresses) the certificate is valid for. Clients match the host against these, not the older Common Name field. |
| Subject public key | The key the certificate vouches for |
| Issuer | The CA that signed it |
| Validity (not before, not after) | The time window in which it is valid |
| Basic constraints | Whether this certificate may itself act as a CA |
| Key usage and extended key usage | What the key may be used for, such as server authentication |
| Signature | The issuer's signature over all of the above |
Building and checking the chain
Root CAs keep their keys offline and sign intermediate CA certificates, which sign the leaf certificates servers use. The server sends its leaf and intermediates; the client already has the roots in its trust store.
Leaf: api.example.com
Sent by the server
Intermediate CA
Sent by the server
Root CA
In the client's trust store
Also in the picture
CT logs
- Public, append-only
Walk the signatures upward
The intermediate's key verifies the leaf's signature; the root's key verifies the intermediate's. The chain must end at a root the client already trusts.
The checks, in order:
- Chain building: find a path from the leaf through intermediates to a trusted root.
- Signatures: each certificate's signature verifies with its issuer's public key.
- Validity period: every certificate in the chain is currently valid.
- Basic constraints: every certificate that signed another is marked as a CA, within any path-length limit.
- Usage: the leaf's extended key usage allows server authentication.
- Name: the host the client intended matches a SAN in the leaf.
- Revocation, where checked, and Certificate Transparency proof, where required.
Use the platform's validation library. Most real-world certificate bugs are hand-written checks that skip one of these steps, or code that disables validation entirely.
The rules inside the chain
RFC 5280 (2008) is the profile that defines X.509 path validation for the internet, and a handful of its rules explain most real bugs.
- Basic constraints. Only a certificate with
cA=TRUEmay sign other certificates. Validation code that forgets this check lets any leaf certificate act as a CA for any name, which is one of the oldest and most damaging bug classes in TLS libraries. - Path length.
pathLenConstrainton a CA limits how many intermediates may follow it;0means it may sign leaves only, so an issuing intermediate cannot mint further sub-CAs. - Name constraints. A CA certificate may carry a critical extension listing permitted and excluded name subtrees. Exclusions win over permissions, and the constraints apply to both the subject alternative names and the subject's distinguished name of every certificate below. A private intermediate constrained to
.corp.examplecannot issue a certificate a conformant client will accept for any other domain, even though every signature checks out. - Name matching. RFC 9525 (2023), which replaced RFC 6125, bases service identity on the subject alternative name entries. Browsers stopped falling back to the Common Name years ago.
- Libraries that do not check names by default. OpenSSL validates the chain but checks the hostname only if the application asks (
SSL_set1_hostsince 1.1.0, or the verify-param equivalent since 1.0.2). Code that builds TLS clients directly on such libraries and never sets the host accepts any valid certificate for any name. - Serial numbers. CA/Browser Forum rules have required at least 64 bits of random output in public certificate serial numbers since 2016. The reason is history: in December 2008, researchers used a chosen-prefix MD5 collision against a CA that issued predictable serial numbers and timestamps to create a rogue CA certificate. Unpredictable serials make that kind of precomputed collision impractical, and MD5 is long gone.
Building the chain is a separate problem
Validation checks a chain; something has to build it first. Servers should send the leaf and every intermediate. Browsers may fetch a missing intermediate from the URL in the Authority Information Access field or use a cached copy, but most API clients and languages do not, so a server that sends only its leaf works in a browser and fails in a script. Cross-signing, where one intermediate is signed by two roots, lets a new root be trusted by old devices; when the older root expires, clients that build the path through it fail even if they also trust the newer one. The expiry of DST Root CA X3 on 30 September 2021 broke exactly those clients, including OpenSSL 1.0.x, whose chain building preferred the expired path.
Certificate Transparency
Any of the many trusted CAs can issue a certificate for any domain, so one compromised or careless CA can undermine everyone. Certificate Transparency (RFC 6962) requires publicly trusted certificates to be recorded in public, append-only logs built on Merkle trees. Browsers check for signed certificate timestamps (SCTs) proving a certificate was logged. Domain owners can then monitor the logs for certificates they did not request. CT does not prevent mis-issuance; it makes it detectable, which changes CA incentives.
Getting a certificate: what domain validation proves
A publicly trusted certificate for a name is issued after the CA checks that the requester controls the name, usually through ACME (RFC 8555, 2019). The common challenges:
| Challenge | What the requester proves | Notes |
|---|---|---|
| HTTP-01 | They can serve a token at http://<name>/.well-known/acme-challenge/ on port 80 | Needs the name to point at a web server; cannot issue wildcards |
| DNS-01 | They can publish a TXT record at _acme-challenge.<name> | Works for wildcards and internal names; needs DNS API credentials |
| TLS-ALPN-01 | They can answer a special TLS handshake on port 443 (RFC 8737) | For servers that cannot change HTTP or DNS |
Domain validation proves control of a name as seen from the CA's network, which is why routing and DNS attacks matter. Two controls narrow it:
- CAA records (RFC 8659) name the CAs allowed to issue for a domain, and CAs have been required to check them since September 2017. RFC 8657 extensions let a domain restrict issuance to a specific ACME account (
accounturi) and to specific challenge types (validationmethods), so a hijacker who can answer HTTP-01 still cannot get a certificate if only DNS-01 from your account is allowed. - Multi-perspective issuance corroboration makes CAs validate from several network vantage points in different regions. The requirement is four remote perspectives today and five from 15 December 2026, so a BGP hijack visible from one part of the internet is no longer enough.
ACME client
your account key
DNS provider API
writes the TXT record
Certificate authority
checks CAA and the record
CT logs
every issuance is public
What each step defends
Account binding
- CAA accounturi names your account
Scoped DNS credentials
- Only _acme-challenge records
Several vantage points
- Four now, five from Dec 2026
Monitoring
- Alert on certificates you did not request
Prove control
The client publishes a token in DNS. Whoever holds the DNS API credentials can do the same, so scope them tightly.
Revocation, and why lifetimes are shrinking
When a private key is compromised, its certificate should be revoked. The mechanisms are weak in practice. Certificate revocation lists (CRLs) can be large and stale; OCSP lookups add latency and leak browsing to the CA, and clients often "soft fail", accepting the certificate if the check cannot complete. Let's Encrypt removed OCSP URLs from its certificates in May 2025 and shut down its OCSP responders on 6 August 2025, relying on CRLs and short lifetimes instead.
The industry's answer is shorter certificates, so a compromised key is useful for less time. In April 2025 the CA/Browser Forum approved a phased reduction of the maximum public TLS certificate lifetime, reaching 47 days by 2029 (checked November 2026). That makes automated issuance and renewal, for example with the ACME protocol, a requirement rather than a convenience.
Fleet arithmetic: why automation stops being optional
Take 2,000 public certificates renewed when two-thirds of their lifetime has passed.
| Maximum lifetime | Renewal interval | Issuances per year | Domain validation reuse |
|---|---|---|---|
| 90 days (Let's Encrypt's classic default) | 60 days | about 12,200 | up to 200 days (the limit since 15 March 2026) |
| 47 days (cap from 15 March 2029) | about 31 days | about 23,300 | 10 days, so almost every renewal re-validates |
At the 2029 limits, the DNS-01 credentials are used about 64 times a day. That makes them a crown jewel: whoever holds them can issue for every name they cover. Scope them to TXT records under _acme-challenge (or delegate that label by CNAME to a dedicated zone), store them in a secrets manager, and rely on CT monitoring plus CAA accounturi to catch misuse. ACME Renewal Information (RFC 9773) lets the CA suggest when to renew, which also lets it trigger early renewal during an incident. Let's Encrypt has offered certificates valid for about six days since January 2026 for operators who want to rely on expiry rather than revocation entirely.
Root programs and distrust
Browsers and operating systems decide which roots to trust, and their policies shape the whole ecosystem. Chrome's root programme policy removes roots whose keys are more than 15 years old on a rolling schedule, and requires hierarchies dedicated to TLS server authentication, which is why public CAs are dropping the client-authentication usage from server certificates; mutual TLS identities belong on a private CA. When a CA fails, browsers distrust it: Chrome removed trust in Symantec's PKI across Chrome 66 and 70 in 2018, and in late 2024 Chrome, Mozilla and Apple stopped trusting new Entrust certificates, with Chrome keying the cut-off to certificates whose earliest SCT was after 11 November 2024.
Private PKI
Organisations run their own CAs for internal services, device identity and mutual TLS. The same rules apply, with you as the root: protect the root key (offline or in an HSM), issue short-lived certificates automatically, constrain what each intermediate may issue, and decide carefully which systems trust your root. Adding a corporate root to every laptop's trust store means anyone who controls that root can intercept those laptops' TLS.
Worked example: a name-constrained private CA
A company runs an internal PKI for service-to-service TLS. The issuing intermediate carries:
- a critical name-constraints extension permitting DNS names under
.corp.exampleand excluding all IPv4 and IPv6 address ranges; pathLenConstraint: 0, so it cannot create sub-CAs;- a three-year lifetime, with the root kept offline in an HSM.
Leaves are issued automatically with 30-day lifetimes.
| Leaf presented | Outcome in a conformant client | Why |
|---|---|---|
SAN api.corp.example | Accepted | Inside the permitted subtree |
SAN login.bank.example, issued by someone misusing the intermediate | Rejected | Outside the permitted subtree, though every signature verifies |
No SAN, Common Name login.bank.example | Rejected | No SAN to match, and name constraints also apply to the subject name |
| A sub-CA certificate signed by the intermediate | Rejected | Path length 0 forbids it |
The design means a stolen intermediate key can only impersonate internal names, not the bank, and the root's compromise is the only catastrophe left, which is why it stays offline.
Misconceptions interviewers listen for
- "Validating a certificate means checking its signature." Path building, issuer rules, validity, name constraints, usage and name matching all have to pass.
- "Intermediates are trusted because the server sent them." They must chain to a trust anchor the client already holds.
- "Revocation is checked on every handshake." Browsers use pushed revocation data; most clients check nothing online.
- "Domain validation proves who the requester is." It proves control of a name from the CA's vantage points, which routing and DNS attacks can fool.
- "Our TLS library checks the hostname." Some only do so when the application configures it.
What if · interview follow-ups
Hold your answer as the constraints change
You own certificates for a company with public websites and APIs, an internal service mesh using a private CA, and a fleet of devices that call the API. The interviewer changes one thing at a time.
Start here
What if the API server sends only its leaf certificate?
Which clients fetch missing intermediates?
Browsers usually cope, through AIA fetching or cached intermediates, but many API clients, scripts and devices do not, so failures appear only for some clients and look intermittent. Configure the server to send the full chain to, but not including, the root, and test with a client that does no AIA fetching.
Carry it forwardChain building is the server's job as much as the client's; send every intermediate.
Weak answerConcluding the certificate is fine because it works in a browser.
Constraint changes
What if an old cross-signed root that some devices rely on expires?
Which path do those devices build?
Devices that do not have the newer root, or whose chain building prefers the expired path, start failing, as happened when DST Root CA X3 expired in 2021. Inventory device trust stores and TLS library versions before the date, decide which chain to serve, and update devices or pin them to a chain they can validate.
Carry it forwardA root expiry is a client-population problem; know which trust stores your clients have.
Weak answerAssuming root expiry only matters to the CA.
Constraint changes
What if the DNS API key used for ACME DNS-01 leaks?
What can its holder prove to any CA?
They can pass DNS-01 for every name the key covers and get valid certificates from any CA that CAA allows. Rotate the key, scope the replacement to _acme-challenge TXT records or a delegated zone, set CAA with accounturi so only your ACME account can issue, and check CT logs for certificates issued while the key was exposed, revoking any you did not request.
Carry it forwardWhoever can prove control of a name can get a certificate for it; protect validation credentials accordingly.
Weak answerRotating the DNS key without checking CT for issued certificates.
Constraint changes
What if the service mesh's mTLS client certificates come from a public CA?
What are root programmes requiring of public hierarchies?
Public hierarchies are being restricted to TLS server authentication, and public CAs are dropping the client-authentication usage, so those certificates will stop being issued for that purpose. Move service identity to a private CA with name constraints, short-lived automatically issued certificates and an authorisation layer that decides which identities may call which services.
Carry it forwardPublic PKI is for public server names; internal identity belongs on a private CA you control.
Weak answerPlanning to keep public certificates for internal client authentication.
Constraint changes
What if the private intermediate's key is stolen?
What did name constraints and path length limit?
The attacker can issue certificates for internal names only, because the name constraints make anything else fail, and cannot create sub-CAs. Revoke and replace the intermediate, reissue leaves (short lifetimes make that routine), find how the key was exposed, and if it was not in an HSM, put the new one there. Relying parties keep trusting the root, which never left its offline HSM.
Carry it forwardConstrain intermediates so a stolen key's reach is designed in advance.
Weak answerRebuilding the whole PKI from the root for an intermediate compromise.
Now defend it
As the defender, what would a certificate inventory and alerting setup include?
Every public certificate for your names from CT logs reconciled with what you requested, CAA records with account and method restrictions, days to expiry and last renewal status per endpoint, the chain each endpoint serves, the issuing intermediates and their constraints for private PKI, and alerts on unexpected issuance, failed renewals and endpoints serving incomplete chains.
Primary references
References for the mechanisms discussed above, accessed 6 November 2026:
How this shows up in interviews
"How is a certificate chain validated, and what goes wrong in practice?" tests whether you know validation is more than a signature check. Strong answers list the checks in order, call out hostname verification and basic constraints as the classic bugs, and explain why revocation is unreliable and how CT and short lifetimes compensate. For AI roles, connect it to agents and tool clients: any code that talks to model APIs or MCP servers with verification disabled has thrown all of this away.
Say it in 30 seconds: "A certificate binds a name to a public key and is signed by a CA. The client builds a chain from the server's leaf through intermediates to a root it already trusts, and checks every signature, the validity dates, that each signer is a CA, the key usage, and that the leaf's SAN matches the host. Certificate Transparency logs make mis-issuance visible. Revocation is unreliable, so lifetimes are shrinking toward 47 days and renewal has to be automated."
Check yourself
Say or write your answer first, then reveal. Explaining it from memory, in your own words, is the skill an interviewer is checking.
1A company's security team installs its own root certificate on all employee laptops so a proxy can inspect TLS traffic. What new risk does that create?
2Why does Certificate Transparency help a domain owner even though it does not stop a CA from issuing a bad certificate?
3A private intermediate is constrained to .corp.example. An attacker with its key issues a certificate for login.bank.example. Why do conformant clients reject it?
4What do CAA accounturi and validationmethods add to a plain CAA record?