<!-- https://pkizerotohero.com/how-does-pki-work/ | Markdown mirror of the HTML page | PKI Zero to Hero, by Duyutech BV -->

> How does PKI work? Follow one certificate step by step: key pair, CSR, CA checks, signing, CT logs, the TLS handshake, chain checks and renewal.

Source: https://pkizerotohero.com/how-does-pki-work/ · Last reviewed: 2026-10-20

PKI explained

# How does PKI work?

**The short answer:**

PKI works in two phases. First, a certificate authority (CA) checks that you control a name and signs a certificate binding your public key to it. Then, on every connection, the other side checks that certificate's chain up to a root it already trusts, and you prove you hold the matching private key.

Who it is for

- [Beginner](https://pkizerotohero.com/start/#beginner)
- [Developer](https://pkizerotohero.com/start/#developer)
- [IT ops](https://pkizerotohero.com/start/#itops)
- [Leader](https://pkizerotohero.com/start/#leader)
- [Expert](https://pkizerotohero.com/start/#expert)

Level

Beginner

Reading time

About 11 minutes

This page follows one website certificate from its first day to its last, so that you can see each part of [public key infrastructure](https://pkizerotohero.com/what-is-pki/) doing its job. The example is HTTPS, because it is the PKI everyone uses every day, but code signing, email and device certificates go through the same steps. Beginners can read it from top to bottom. Developers and IT teams will find a link into the handbook at every step.

## Why does PKI need all these steps?

Public-key cryptography gives everyone a [key pair](https://pkizerotohero.com/handbook/glossary/#key-pair): a [private key](https://pkizerotohero.com/handbook/glossary/#private-key) that only the owner holds, and a [public key](https://pkizerotohero.com/handbook/glossary/#public-key) that anyone may have. With the private key, the owner makes [digital signatures](https://pkizerotohero.com/handbook/glossary/#digital-signature) that anyone can check with the public key ([key pairs](https://pkizerotohero.com/handbook/key-pairs/), [digital signatures](https://pkizerotohero.com/handbook/digital-signatures/)).

That solves half the problem. The other half is this: a public key is just a long number, and nothing on it says whose it is. If an attacker hands you their own public key labelled “your bank”, every signature check and every encrypted message works perfectly, with the wrong party. This is the man-in-the-middle problem, explained in [Whose key is it?](https://pkizerotohero.com/handbook/binding-identity/)

PKI’s answer is a [certificate](https://pkizerotohero.com/handbook/glossary/#certificate): a statement “this public key belongs to this name”, signed by a [certificate authority](https://pkizerotohero.com/handbook/glossary/#certificate-authority) (CA) that your software already trusts. Everything below is about making that statement, checking it, and taking it back when it stops being true.

## How does PKI work, step by step?

Follow `www.example.com` as it gets a certificate and uses it. Steps 1 to 4 happen once for each certificate. Steps 5 to 7 happen on every connection, in a fraction of a second. Step 8 closes the loop.

*Diagram: Eight numbered steps in two rows. Top row, getting the certificate: 1, key pair, the private key never leaves; 2, CSR with the public key and names; 3, the CA checks that you control the name; 4, the CA signs the certificate and logs it in CT logs. An arrow leads to the second row, using it on every connection: 5, the server sends its certificate and intermediate; 6, the client checks the chain up to its trust store; 7, the server signs with its private key; then a box marked with a tick: trusted, name and key both proven. Bottom row: 8, before the end date, renew by starting again at step 1, or the CA revokes the certificate if the key leaked; and a box marked with a cross: if any check fails, such as a wrong name, an expired certificate or an unknown root, there is no connection.*

Steps 1 to 4 happen once per certificate. Steps 5 to 7 happen on every connection.

### 1\. The owner generates a key pair

The website’s server, or a hardware security module attached to it, creates a new key pair, for example an elliptic-curve P-256 key. The private key stays where it was made. It is never sent to the CA, and it never appears in the certificate. Everything that follows depends on this one secret staying secret.

### 2\. The owner asks for a certificate with a CSR

The server puts its public key and the names it wants, `www.example.com` and `example.com`, into a [certificate signing request](https://pkizerotohero.com/handbook/glossary/#certificate-signing-request) (CSR), in the PKCS #10 format of RFC 2986 (PKCS #10). It signs the CSR with its private key. That signature shows the CA that the requester really holds the private key that belongs to the public key inside.

Today this step is usually automatic. An ACME client such as certbot creates the key and the CSR and talks to the CA by itself, using the protocol of RFC 8555. To do it by hand, see [the CSR chapter](https://pkizerotohero.com/handbook/csr/) and the [OpenSSL CSR guide](https://pkizerotohero.com/guides/create-csr-openssl/).

### 3\. The CA checks that you control the name

Anyone can send a CA a request for any name, so the CA must check before it signs. For a normal website certificate, it gives the requester a random challenge and checks that they can place it on the website, in the domain’s DNS, or in a special TLS answer. This is [domain validation](https://pkizerotohero.com/handbook/glossary/#domain-validation).

Public CAs must also read the domain’s CAA records, which list the CAs allowed to issue for that name. And since 15 March 2025, CAs must repeat domain validation and CAA checks from several network locations, so that one hijacked network path cannot fool them. For organisation-validated (OV) and extended-validation (EV) certificates, the CA also checks the company behind the name. [Proving you own the name](https://pkizerotohero.com/handbook/domain-validation/) covers all three levels.

### 4\. The CA signs the certificate and logs it in public

The CA builds the certificate: the public key, the names, a serial number, a start date, an end date and a few extensions. Then it signs it with the private key of its issuing CA, which lives in a hardware security module. That signature is what the rest of the world relies on. As RFC 5280 puts it, “The binding is asserted by having a trusted CA digitally sign each certificate” ([section 3.1](https://www.rfc-editor.org/rfc/rfc5280#section-3.1)).

Before a public CA hands the certificate over, it logs a preview copy, a precertificate, in several [Certificate Transparency](https://pkizerotohero.com/handbook/certificate-transparency/) logs and usually puts their signed receipts, called SCTs, inside the certificate. Chrome, Apple’s platforms and Firefox on desktop accept a public TLS certificate only with those receipts, so every certificate they will accept is visible to anyone who looks. The end date is limited too. Since 15 March 2026, a public TLS certificate may be valid for at most 200 days, and the limit falls in steps to 47 days from 15 March 2029.

### 5\. The server sends its certificate and the intermediate

The owner installs the certificate next to the private key that never moved. On every new connection, the server sends its own certificate, the [leaf](https://pkizerotohero.com/handbook/glossary/#leaf-certificate), together with the [intermediate certificate](https://pkizerotohero.com/handbook/glossary/#intermediate-certificate) that signed it. It does not need to send the root, because the client must already have it.

Leaving out the intermediate is one of the most common certificate mistakes. Browsers often hide it, because they can fetch the missing intermediate or may have cached it, while curl on Linux, Python and Java fail with [unable to get local issuer certificate](https://pkizerotohero.com/errors/curl-unable-to-get-local-issuer-certificate/). [Certificate chains](https://pkizerotohero.com/handbook/certificate-chains/) explains why, and the guide on [checking the chain a server sends](https://pkizerotohero.com/guides/check-remote-certificate-chain/) shows how to test yours.

### 6\. The client checks the certificate

The browser now runs [path validation](https://pkizerotohero.com/handbook/glossary/#path-validation), the algorithm in [RFC 5280, section 6](https://www.rfc-editor.org/rfc/rfc5280#section-6), and a separate name check. Together they check that:

- each signature in the chain verifies with the public key of the certificate above it;
- the chain ends at a root certificate in the client’s own [trust store](https://pkizerotohero.com/handbook/glossary/#trust-store);
- every certificate is within its dates, measured by the client’s own clock;
- the intermediate is marked as a CA, and each certificate is allowed to do this job;
- `www.example.com` appears in the leaf’s [Subject Alternative Name](https://pkizerotohero.com/handbook/glossary/#subject-alternative-name) list ([RFC 9525](https://www.rfc-editor.org/rfc/rfc9525)). Browsers do not use the Common Name for this, and other modern clients ignore it whenever the certificate lists a DNS name.

Browsers add checks of their own: the Certificate Transparency receipts and, in Chrome and Firefox, revocation lists that they download in the background. If any check fails, the browser stops and shows an error such as [`NET::ERR_CERT_AUTHORITY_INVALID`](https://pkizerotohero.com/errors/chrome-err-cert-authority-invalid/).

Notice where the chain must end: at a root that is already in the client’s trust store. A root is not trusted because it signed itself, since anyone can make a self-signed certificate. It is trusted because a browser or operating-system maker, or your own IT team, put it there after reviewing the CA behind it ([What is a certificate authority?](https://pkizerotohero.com/what-is-a-certificate-authority/)).

You can run the same checks yourself. The chain checker below is loaded with a working sample: a leaf for `www.example.com`, its intermediate and its root.

*Interactive tool: Chain checker (runs in the browser at [/tools/chain/](https://pkizerotohero.com/tools/chain/))*

Look at how each certificate’s issuer matches the subject of the next one up, and where the chain ends.

### 7\. The server proves it holds the private key

A certificate is public. Every visitor gets a copy, so having a copy proves nothing. In the TLS 1.3 handshake, defined in RFC 9846, the server therefore signs a hash of the whole handshake so far with its private key, in a message called [CertificateVerify](https://pkizerotohero.com/handbook/glossary/#certificate-verify) ([section 4.5.2](https://www.rfc-editor.org/rfc/rfc9846#section-4.5.2)). The browser checks that signature with the public key from the certificate. Only the holder of the private key can produce it, and it is valid for this one connection only.

The keys that then encrypt the web page do not come from the certificate. Client and server agree them separately, with a fresh [ECDHE](https://pkizerotohero.com/handbook/glossary/#ecdhe) key exchange whose secrets are thrown away afterwards. The certificate authenticates the server; it does not encrypt anything. [PKI vs TLS](https://pkizerotohero.com/pki-vs-tls/) explains how the two fit together.

### 8\. The certificate is renewed, or revoked

Every certificate has an end date, and nobody can extend it. Before that date, the owner goes back to step 1, ideally with a new key, and gets a new certificate. With lifetimes this short, renewal has to be automated: see [ACME and the 47-day schedule](https://pkizerotohero.com/handbook/acme/) and the [certbot guide](https://pkizerotohero.com/guides/certbot-lets-encrypt/).

If the private key leaks, or the certificate was issued by mistake, the CA revokes it. Once a public CA has evidence that a certificate’s key was compromised, it must revoke the certificate within 24 hours ([Baseline Requirements](https://cabforum.org/working-groups/server/baseline-requirements/requirements/), section 4.9.1.1) and publish it in its certificate revocation list. But clients only learn about a revocation if they check, and browser revocation checking is largely soft-fail. That is a big reason why lifetimes keep shrinking: expiry stops a bad certificate for every client ([revocation](https://pkizerotohero.com/handbook/revocation/)).

## What can go wrong at each step?

Each step has its own typical failure, and most certificate problems you will ever meet trace back to one of them:

| Step | What goes wrong | What you see | Read more |
| --- | --- | --- | --- |
| 1\. Key pair | The private key leaks, for example into a code repository | Nothing, until someone impersonates you | [Key pairs](https://pkizerotohero.com/handbook/key-pairs/) |
| 2\. CSR | A name is missing from the request | A name error for that name later | [`NET::ERR_CERT_COMMON_NAME_INVALID`](https://pkizerotohero.com/errors/chrome-err-cert-common-name-invalid/) |
| 3\. Validation | The CA cannot reach the challenge, or a CAA record names another CA | No certificate is issued | [Proving you own the name](https://pkizerotohero.com/handbook/domain-validation/) |
| 4\. Issuance | A CA issues a certificate for your name to someone else | An unexpected entry in the CT logs | [Certificate Transparency](https://pkizerotohero.com/handbook/certificate-transparency/) |
| 5\. Server | The intermediate is not sent | `unable to get local issuer certificate` outside browsers | [The curl error page](https://pkizerotohero.com/errors/curl-unable-to-get-local-issuer-certificate/) |
| 6\. Client | The root is not in this client’s trust store | [`NET::ERR_CERT_AUTHORITY_INVALID`](https://pkizerotohero.com/errors/chrome-err-cert-authority-invalid/) | [Who do we trust?](https://pkizerotohero.com/handbook/trust-stores/) |
| 7\. Handshake | The server has the certificate but not its matching private key | The server refuses to start, or every handshake fails | [Check that a key matches](https://pkizerotohero.com/guides/check-key-matches-certificate/) |
| 8\. Renewal | Nobody renewed in time | [`NET::ERR_CERT_DATE_INVALID`](https://pkizerotohero.com/errors/chrome-err-cert-date-invalid/), for every user at once | [Inventory, expiry and renewal](https://pkizerotohero.com/handbook/certificate-lifecycle/) |

The pattern is worth remembering. A leaked key or a wrongly issued certificate (steps 1 and 4) is silent: you only find it by watching, with key hygiene and [Certificate Transparency monitoring](https://pkizerotohero.com/guides/monitor-certificate-transparency/). The other failures are loud, and steps 5 to 8 usually fail in front of your users. If you are fixing an error right now, the [error finder](https://pkizerotohero.com/tools/error-finder/) maps the exact message to its page.

## Does PKI work the same way outside the browser?

Yes. The eight steps barely change. What changes is who holds the key, who checks the certificate, and for which job:

| Use | Who holds the private key | Who checks the certificate |
| --- | --- | --- |
| HTTPS | the web server | browsers and apps |
| [Mutual TLS](https://pkizerotohero.com/handbook/mutual-tls/) | both the client and the server | each other, usually against a private CA |
| [Code signing](https://pkizerotohero.com/handbook/code-signing/) | the software publisher | the operating system, before it runs the program |
| Signed email (S/MIME) | the sender | the recipient’s mail program |
| [Device identity](https://pkizerotohero.com/handbook/device-identity/) | the device, often in a secure chip | the network or cloud service it connects to |

The certificate’s extended key usage says which of these jobs its key may do, so software signed with a website certificate is not accepted. [PKI use cases](https://pkizerotohero.com/pki-use-cases/) has more examples, and [PKI components](https://pkizerotohero.com/pki-components/) names every part involved.

## Where to go next

- **New to all this?** The [crash course](https://pkizerotohero.com/course/) explains the ideas in ten short lessons, starting with [Secrets and the sharing problem](https://pkizerotohero.com/course/secrets-and-sharing/).
- **Want the big picture first?** Read the overview of [PKI](https://pkizerotohero.com/what-is-pki/), then [What is a digital certificate?](https://pkizerotohero.com/what-is-a-digital-certificate/)
- **Developers:** [certificate chains](https://pkizerotohero.com/handbook/certificate-chains/), [the TLS 1.3 handshake](https://pkizerotohero.com/handbook/tls-handshake/) and the [error pages](https://pkizerotohero.com/errors/).
- **IT operations:** [create a key and a CSR](https://pkizerotohero.com/guides/create-csr-openssl/), [automate renewal with certbot](https://pkizerotohero.com/guides/certbot-lets-encrypt/), and the [chain checker](https://pkizerotohero.com/tools/chain/).
- **Leaders:** [PKI for leaders in 10 minutes](https://pkizerotohero.com/leaders/).

## Frequently asked questions

### Does the certificate authority ever see my private key?

No. You generate the key pair yourself and send the CA only a certificate signing request, which holds your public key, the names you want and a signature. The signature proves that you hold the private key without revealing it. If a provider offers to generate the key for you, it has seen your key, so prefer generating it on the server or hardware that will use it.

### How long does it take to get a certificate?

A domain-validated certificate from an automated CA takes seconds to a few minutes: the ACME client proves control of the name and receives the certificate in one run. Organisation-validated and extended-validation certificates take longer, often days, because the CA also checks the company's registration and contact details. A private CA inside a company can issue in seconds, under its own rules.

### Does PKI work without an internet connection?

Mostly, yes. The client already holds its trust store, and the server sends its certificate chain during the handshake, so the signature, chain, name and date checks need no extra network access. What needs the network is fetching a missing intermediate and checking revocation online. What needs care is the clock: a device with the wrong time rejects good certificates, or accepts expired ones.

### What happens if a CA's own private key is stolen?

Whoever holds it can sign certificates for any name, and every client that trusts that CA will accept them. The CA must revoke the affected CA certificate, and the browser makers may remove the CA from their trust stores entirely. That is why CA keys live in hardware security modules, roots stay offline, and Certificate Transparency lets domain owners spot certificates they never asked for.

### Can you use public keys without a certificate authority?

Yes, but then you need another way to know whose key is whose. SSH usually trusts a server's key the first time it sees it and warns you if it changes later. Some systems compare key fingerprints over the phone or build a known key into the application. These methods work for a few known parties, but they do not scale to the whole web, which is why browsers rely on CAs.

**Early edition.** Written with AI assistance and checked against primary sources; an independent expert review is planned. Found a mistake? [Tell us](https://pkizerotohero.com/contact/?topic=content-error&page=/how-does-pki-work/).

Last reviewed 20 October 2026Edition 0.9

## Keep going

### In depth: handbook chapters

- [Chapter 3: Key pairs: public and private keys](https://pkizerotohero.com/handbook/key-pairs/)
- [Chapter 6: Digital signatures](https://pkizerotohero.com/handbook/digital-signatures/)
- [Chapter 7: Whose key is it? Binding identity to keys](https://pkizerotohero.com/handbook/binding-identity/)
- [Chapter 8: X.509 certificate explained: anatomy of a certificate](https://pkizerotohero.com/handbook/x509-certificates/)
- [Chapter 10: Asking for a certificate: key generation and the CSR](https://pkizerotohero.com/handbook/csr/)
- [Chapter 11: Proving you own the name: DV, OV, EV and CAA](https://pkizerotohero.com/handbook/domain-validation/)
- [Chapter 17: Certificate Transparency](https://pkizerotohero.com/handbook/certificate-transparency/)
- [Chapter 12: Who do we trust? CAs, trust stores and self-signed certificates](https://pkizerotohero.com/handbook/trust-stores/)
- [Chapter 13: Certificate chains and path validation](https://pkizerotohero.com/handbook/certificate-chains/)
- [Chapter 15: The TLS 1.3 handshake](https://pkizerotohero.com/handbook/tls-handshake/)
- [Chapter 16: Taking it back: CRLs, OCSP and stapling](https://pkizerotohero.com/handbook/revocation/)
- [Chapter 20: ACME and the 47-day schedule](https://pkizerotohero.com/handbook/acme/)
- [Chapter 19: Inventory, expiry and renewal](https://pkizerotohero.com/handbook/certificate-lifecycle/)

### Do it: how-to guides

- [How to create a key and a CSR with OpenSSL (with SANs)](https://pkizerotohero.com/guides/create-csr-openssl/)
- [How to get and renew Let's Encrypt certificates with certbot](https://pkizerotohero.com/guides/certbot-lets-encrypt/)
- [How to check the certificate chain a server sends](https://pkizerotohero.com/guides/check-remote-certificate-chain/)
- [How to check that a private key matches a certificate](https://pkizerotohero.com/guides/check-key-matches-certificate/)
- [How to monitor Certificate Transparency for your domains](https://pkizerotohero.com/guides/monitor-certificate-transparency/)

### Fix it: error pages

- [SSL certificate problem: unable to get local issuer certificate](https://pkizerotohero.com/errors/curl-unable-to-get-local-issuer-certificate/)
- [NET::ERR\_CERT\_AUTHORITY\_INVALID](https://pkizerotohero.com/errors/chrome-err-cert-authority-invalid/)
- [NET::ERR\_CERT\_COMMON\_NAME\_INVALID](https://pkizerotohero.com/errors/chrome-err-cert-common-name-invalid/)
- [NET::ERR\_CERT\_DATE\_INVALID](https://pkizerotohero.com/errors/chrome-err-cert-date-invalid/)

### Check yours: tools

- [Chain checker](https://pkizerotohero.com/tools/chain/): Paste a chain and see which link is missing, expired or out of order.
- [Paste your error](https://pkizerotohero.com/tools/error-finder/): Paste a certificate error from any tool and get the page that explains it.

### Topics

- [Chains and trust stores](https://pkizerotohero.com/topics/chains-and-trust/)
- [TLS and HTTPS](https://pkizerotohero.com/topics/tls/)

### More PKI explained

- [What is PKI? Public key infrastructure explained](https://pkizerotohero.com/what-is-pki/)
- [PKI components: CA, RA, repositories, revocation and more](https://pkizerotohero.com/pki-components/)
- [What is a digital certificate?](https://pkizerotohero.com/what-is-a-digital-certificate/)
- [What is a certificate authority (CA)?](https://pkizerotohero.com/what-is-a-certificate-authority/)
- [PKI vs TLS (and SSL): how they fit together](https://pkizerotohero.com/pki-vs-tls/)
- [Public vs private PKI: which do you need?](https://pkizerotohero.com/public-vs-private-pki/)
- [PKI architecture: one-, two- and three-tier hierarchies](https://pkizerotohero.com/pki-architecture/)
- [PKI best practices: a checklist](https://pkizerotohero.com/pki-best-practices/)
- [PKI use cases and examples](https://pkizerotohero.com/pki-use-cases/)
- [PKI interview questions and answers](https://pkizerotohero.com/pki-interview-questions/)
- [Security+ PKI: certificates, CAs and keys](https://pkizerotohero.com/security-plus-pki/)
