Public-Key Infrastructure and Certificates
Learn how public-key infrastructure uses certificates and trusted authorities to verify names, support TLS, and avoid common renewal and revocation failures.
PKI lets clients link a public key to a claimed name through signed certificates and a chain of trusted authorities. This guide explains chain building, hostname checks, TLS, expiry and revocation, then covers failures such as incomplete chains, stale endpoints, and exposed keys. Use it to plan certificate monitoring and key response, and keep the certificate's limited identity claim clear.
Public-Key Infrastructure and Certificates
Introduction
When you visit a site over HTTPS, your browser needs a way to check that it is talking to the server for the name in the address bar. Public-key infrastructure (PKI) provides that trust framework. It uses public-key cryptography, digital certificates, and organizations called certificate authorities (CAs) to connect a domain name to a public key.
The terminology can make PKI sound more mysterious than it is. The useful question is simple: who signed this certificate, what name does it cover, and does the browser trust that signer? A certificate can help answer those questions, but it says nothing by itself about whether a site is honest, safe to use, or well run.
What a Certificate Says
A TLS certificate is a signed data structure. It commonly includes:
- The subject’s public key.
- One or more DNS names in the Subject Alternative Name (SAN) field.
- The issuer that signed it.
- A validity period and cryptographic signature.
- Constraints or usage information, such as whether it may issue other certificates.
The CA’s signature means that the issuer signed the certificate contents. The browser can check that signature with the issuer’s public key. A signature does not make the contents universally true; the CA is vouching according to its validation process and certificate policy.
Certificate Authorities and Chains
A certificate authority issues and signs certificates. Root CA certificates are distributed as trust anchors in operating systems, browsers, and managed devices. Roots usually sign intermediate CA certificates, and an intermediate signs the website’s leaf certificate. This hierarchy lets a root protect its private key more carefully while intermediates handle routine issuance.
The server typically sends its leaf certificate and any required intermediate certificates. The browser builds a chain from the leaf back to a root in its local trust store. It checks signatures, validity dates, issuer constraints, and other policy rules along the way. The root is usually already known to the browser, so the server generally does not send the root certificate.
flowchart TD
R[Trusted root CA in browser] -->|signs| I[Intermediate CA certificate]
I -->|signs| L[Website certificate for example.com]
L -->|contains| P[Website public key]
P -->|paired with| K[Server proves control of private key during TLS]
L -->|SAN checked against| H[Hostname in the address bar]
The chain check and the name check answer different questions. The chain asks whether a trusted issuer signed the certificate through an acceptable path. The name check asks whether the certificate covers the hostname being visited. A perfectly valid chain for example.com does not authorize other.example.
Name and Identity Validation
Browsers match the hostname against names in the certificate’s SAN extension. A certificate for www.example.com does not automatically cover example.com; both names need to be listed, or covered by an appropriate wildcard name. Wildcards have limits and generally cover one DNS label, so *.example.com does not cover api.eu.example.com.
Most public web certificates use Domain Validation (DV): the applicant demonstrates control of a domain, often by publishing a DNS record or serving a challenge over HTTP. Organization Validation (OV) and Extended Validation (EV) add checks about the requesting organization, but they still do not certify that the organization’s services are safe or that its content is truthful. Browsers do not give EV certificates the old prominent address-bar treatment many people remember.
Expiration, Revocation, and TLS
Certificates have a not-before and not-after time. A client rejects a certificate that is outside that period, subject to its clock and validation behavior. Short validity periods limit how long an unrotated certificate remains useful, but they also make reliable automation more important.
If a certificate or its private key should no longer be trusted before expiry, the issuer or operator can revoke it. Clients may learn about revocation through Certificate Revocation Lists (CRLs) or Online Certificate Status Protocol (OCSP). The exact behavior depends on the client, protocol support, and deployment. Revocation checks are not a substitute for replacing an exposed key quickly; some clients cannot reach a status service and may treat missing status information differently.
TLS uses certificate validation to authenticate the server as part of setting up a protected channel. HTTPS is HTTP carried over TLS. That channel helps prevent network observers from reading or changing traffic in transit, assuming the client validates the connection and the endpoints are not compromised. For a wider overview, see HTTP and HTTPS protocol basics and SSL, TLS, and HTTPS.
A valid certificate is not a general trust badge. It does not tell you whether a shop will deliver a product, whether a login page is phishing, whether the server has malware, or whether the organization handles data responsibly. It verifies a limited relationship between a name and a key under a particular CA’s rules.
When to Use
Use publicly trusted TLS certificates for public websites and APIs so standard browsers and clients can authenticate the service. Internal services can use certificates from a private CA when the organization can securely distribute its trust root and manage issuance. Mutual TLS (mTLS) uses certificates to authenticate clients as well as servers; see the mTLS overview for that pattern.
PKI is also useful for signing software, devices, and internal services, but those use cases need their own trust policies and key lifecycle. A TLS server certificate should not be treated as a general-purpose signing identity.
Production Failure Scenarios
- A certificate expires overnight. A monitoring gap, failed ACME challenge, or disabled renewal job leaves the old certificate in production. Browsers begin warning users, and API clients may refuse connections.
- The chain is incomplete. A load balancer serves the leaf certificate but omits an intermediate. Some clients can build the chain from a cache; others fail, which makes the incident look inconsistent.
- The wrong name is deployed. A certificate covers
api.example.com, but a new route points clients toorders.example.com. TLS negotiation reaches the server, then hostname validation fails. - Renewal updates only one endpoint. A CDN, secondary region, worker, or older load balancer keeps serving the previous certificate. A health check against a single edge misses the stale copy.
- A private key leaks. An exposed key is copied before the team notices. Reissuing a certificate alone does not remove the attacker’s copy; the old certificate must be revoked where feasible, the key retired, and all deployment locations checked.
- A renewal changes certificate details. Automation requests a different SAN set or uses an unexpected intermediate. A superficially successful issuance can still break a hostname or client with a pinned trust configuration.
Trade-Off Table
| Choice | Benefits | Costs and risks |
|---|---|---|
| Public CA | Works with ordinary browsers and clients | Depends on CA policies, domain validation, and external issuance availability |
| Private CA | Fits internal names and organization-specific rules | The trust root must be distributed and protected; clients need lifecycle support |
| Automated renewal | Reduces routine expiry risk and manual work | Requires monitored challenges, credentials, deployment hooks, and alerting |
| Short-lived certificates | Limits the time an unrotated certificate remains valid | Makes renewal and rollout failures visible sooner |
| Wildcard certificate | Covers multiple first-level subdomains with one certificate | A shared private key can have a larger impact if exposed; deeper names are not covered |
Observability Checklist
- Track certificate expiry for every public hostname and each environment, not just the primary domain.
- Alert early enough to fix issuance and rollout problems before the remaining validity becomes urgent.
- Check the certificate actually served at each CDN edge, region, load balancer, and origin where applicable.
- Validate SAN coverage, issuer chain, and handshake behavior from representative client networks.
- Monitor renewal job results and ACME challenge failures; a scheduled job running is not proof that deployment succeeded.
- Record private-key creation, access, rotation, and retirement in the approved secrets or key-management system.
- Exercise a renewal and rollback procedure before an incident makes the certificate deadline immediate.
Security and Compliance Notes
Protect private keys with least-privilege access, encryption at rest where appropriate, and auditable rotation. Limit who can create or approve certificates for sensitive names. For internal PKI, protect root CA keys especially carefully and document how devices receive trust anchors.
Certificate issuance and retention requirements vary by environment and can change. Follow current CA/Browser Forum requirements, applicable regulations, and your organization’s policy; do not treat a certificate’s validation level as a compliance certification. If a key is suspected to be compromised, preserve incident evidence while revoking or replacing it and checking every system that received the key.
Common Pitfalls / Anti-Patterns
- Assuming the padlock means the site is legitimate or harmless.
- Treating a certificate’s Common Name as the only hostname field; modern hostname checks use SAN.
- Copying one private key across unrelated services because it makes deployment easier.
- Renewing a certificate without checking that the full chain and expected names are served afterward.
- Leaving alerts until the final days of a certificate’s validity.
- Assuming revocation information reaches every client immediately or that every client fails closed when it cannot fetch status.
- Disabling certificate verification in an application to silence a connection error.
Quick Recap Checklist
- A public key can be shared; its paired private key must be protected.
- A certificate binds a public key to names and issuer-signed metadata.
- Clients build a chain to a trust anchor and separately verify the hostname.
- TLS uses certificate authentication while negotiating keys for encrypted traffic.
- Expiry, revocation, and renewals are operational concerns that need monitoring.
- A valid certificate is not proof that a site is honest, malware-free, or safe to transact with.
Interview Questions
It proves that the CA signed the certificate's contents with the private key corresponding to the issuer's public key. A client still has to build a trusted chain, check certificate constraints and dates, and match the requested hostname. The signature does not prove that the site is honest or secure in every other respect.
The server uses the private key to prove possession of the key paired with the certificate's public key during the TLS handshake. The certificate can be public because it contains no secret. TLS then establishes symmetric traffic keys for the connection.
The chain check verifies that certificates were signed along a path to a trust anchor and that issuer rules are satisfied. Hostname validation separately checks that the leaf certificate names the host the client intended to reach. Both checks must pass for a normal authenticated HTTPS connection.
No. Clients obtain and enforce revocation data differently, and some cannot reach a CRL or OCSP responder. When a private key is compromised, operators should replace it, deploy the replacement everywhere, and use available revocation mechanisms while accounting for client behavior.
Further Reading
- HTTP and HTTPS protocol basics
- SSL, TLS, and HTTPS
- Mutual TLS (mTLS)
- RFC 5280: X.509 Certificates and CRLs — the Internet PKI certificate and revocation-list profile.
- Let’s Encrypt: Revoking Certificates — operator guidance for certificate revocation.
Conclusion
PKI gives browsers and services a shared way to connect a public key with a claimed name. A client checks the issuer chain, certificate time limits, and hostname before TLS relies on that identity. The cryptography only works as well as the key handling and deployment around it, so teams need renewal alerts, complete-chain checks, and a clear response for exposed keys. A certificate can authenticate a connection; it cannot judge the trustworthiness of everything behind it.
Category
Related Posts
Cryptography Concepts and Safe Algorithms
Understand encryption, hashes, digital signatures, keys, and secure randomness, then learn how to choose vetted cryptographic libraries for real systems.
Password Hashing and Message Integrity
Learn why passwords need slow, salted hashes, how SHA-256 differs from a keyed MAC, and how to verify credentials and data safely.
SSL, TLS, and HTTPS: Securing Web Communication
Understand TLS handshake, certificates, cipher suites, and how HTTPS works. Learn the differences between SSL and TLS and why encryption matters.