Sub topic 3
How Let's Encrypt and ACME issue certificates
This chapter explains what happens between "I want a certificate" and "the CA hands me one". It assumes you know what a TLS certificate and a certificate authority (CA) are, and that you can read HTTP requests and JSON. Domain validation and Certbot usage get their own chapters. Here the focus is the protocol that connects them.
Let's Encrypt and ACME
Let's Encrypt is a free, automated CA run by the nonprofit Internet Security Research Group (ISRG). It issues domain-validated certificates. These prove that the requester controls a domain name. They say nothing about who the requester is.
ACME (Automatic Certificate Management Environment) is the protocol clients use to talk to the CA. It is standardized in RFC 8555. ACME is not specific to Let's Encrypt. Other CAs implement it too, so the same client can often switch CAs by changing one URL.
Two terms are easy to confuse:
- The ACME server is the CA's API. Let's Encrypt runs two: production and staging.
- The ACME client is software on your server. Certbot is one client. Others include acme.sh, lego and Caddy's built-in client.
The directory
Every ACME server publishes a directory, a JSON document that lists the URLs for each operation. A client only needs to know this one URL.
curl -s https://acme-v02.api.letsencrypt.org/directory | python3 -m json.toolThe response includes these keys:
| Key | Purpose |
|---|---|
| `newNonce` | Returns a fresh anti-replay token |
| `newAccount` | Registers or looks up an account |
| `newOrder` | Starts a certificate request |
| `revokeCert` | Revokes a certificate |
| `keyChange` | Rolls over an account key |
| `renewalInfo` | Tells clients when to renew (ACME Renewal Information) |
The staging directory is at https://acme-staging-v02.api.letsencrypt.org/directory. It has the same shape but issues certificates from an untrusted test hierarchy.
How requests are authenticated
ACME runs over HTTPS, but TLS alone is not the security model. Each request that changes state is an HTTP POST whose body is a JSON Web Signature (JWS). The client signs it with its account key.
Two details matter in practice:
- Nonces. Each signed request carries a single-use nonce that the server previously supplied in a
Replay-Nonceheader. This prevents an attacker from replaying a captured request. If a nonce is stale, the server returns abadNonceerror and the client retries with the new one. Good clients do this silently. - Account identification. When creating an account, the request embeds the public key (
jwk). After that, requests carry the account URL (kid), and the server looks up the key.
The account key is separate from the certificate's private key. It authorizes actions such as ordering and revoking. Losing control of it lets someone else request certificates under your account, but it does not let them decrypt your traffic.
The issuance flow
Issuance works through a small set of objects, each with its own URL and status.
- Account. The client registers once. It supplies an optional contact email and agrees to the terms of service. The server returns an account URL. Certbot does this on first run and stores the result under
/etc/letsencrypt/accounts/. - Order. The client asks for a certificate for a list of identifiers, such as
example.comandwww.example.com. The server creates an order. - Authorizations. For each identifier the order links to an authorization. This is the server's record of whether the account has proven control of that name.
- Challenges. Each pending authorization offers one or more challenges: HTTP-01, DNS-01 or TLS-ALPN-01. The client picks one, provisions the proof, and tells the server it is ready. The next chapter covers how each type works.
- Validation. The server checks the proof from its side. Let's Encrypt checks from several network locations, so a single hijacked route is not enough to fool it. If the check passes, the authorization becomes
valid. - Finalize. Once every authorization is valid, the order becomes
ready. The client generates a private key and sends a certificate signing request (CSR) to the order's finalize URL. - Issue. The server signs the certificate and the order becomes
valid. The client downloads the certificate chain from the order's certificate URL.
What an order looks like
An order is a JSON object. This is what a client sees after creating one, trimmed to the important fields:
{
"status": "pending",
"expires": "2026-12-05T03:41:04Z",
"identifiers": [
{ "type": "dns", "value": "example.com" },
{ "type": "dns", "value": "www.example.com" }
],
"authorizations": [
"https://acme-v02.api.letsencrypt.org/acme/authz/AAAA",
"https://acme-v02.api.letsencrypt.org/acme/authz/BBBB"
],
"finalize": "https://acme-v02.api.letsencrypt.org/acme/finalize/1/2"
}The order moves through these statuses:
| Status | Meaning |
|---|---|
| `pending` | Waiting for authorizations to become valid |
| `ready` | All authorizations valid; waiting for a CSR |
| `processing` | CSR received; certificate being issued |
| `valid` | Certificate issued and downloadable |
| `invalid` | An authorization failed or the order expired |
If one name in an order fails validation, the whole order becomes invalid. A request for example.com and www.example.com fails entirely if www has no working DNS record. This is a common surprise.
The CSR and the private key
A CSR contains the public key and the requested names, signed by the matching private key. Your private key never leaves the server. The CA sees only the public half.
The CA does not trust the names in the CSR on their own. It issues only for names whose authorizations are valid in the order. The finalize step fails if the CSR asks for a name the order does not cover.
Certbot generates a new private key at each renewal by default. Set --reuse-key if you need to keep the same key, for example when you pin it elsewhere.
Certificate lifetime and renewal signals
Let's Encrypt certificates are currently valid for 90 days. The CA has announced plans to shorten lifetimes in stages, so build around automation rather than around a fixed number. Certbot's default is to renew when 30 days or fewer remain.
The renewalInfo endpoint adds a server-side signal. The CA can tell clients to renew earlier than usual, for example before a mass revocation. Not every client uses it yet.
Staging and rate limits
The staging server exists so you can test the full flow without affecting production. Its limits are far more generous, and its certificates are not trusted by browsers. Production enforces limits to protect the service. These include caps on new orders per account, certificates per registered domain, and failed validations per hostname. A misconfigured loop that retries a failing validation can lock you out for an hour or longer. Exact numbers change, so check the current limits page before a large rollout. The staging and rate-limit chapter returns to this.
Common errors at this layer
unauthorizedorinvalidauthorization. The server could not see the proof. The cause is a challenge problem, not a protocol problem. Read thedetailfield in the error, which includes what the server fetched or queried.rateLimited. Wait out the window. Use staging while debugging.badNonce. Usually retried automatically. If you see it repeatedly in a custom client, you are reusing a nonce.rejectedIdentifierorinvalidContact. The name is not allowed, such as an IP address or a reserved domain, or the contact email is malformed.- Order stuck in
pending. The client never told the server a challenge was ready, or the client crashed mid-flow. Start a new order. Pending orders expire on their own.
Exercise
You request a certificate for example.com and www.example.com. The www name has no DNS record. Which ACME object fails first, and what happens to the order?
Show answer
The authorization for www.example.com fails, because the server cannot validate the challenge for a name that does not resolve. Since an order is issued only when every authorization is valid, the whole order becomes invalid and no certificate is issued for either name. Add the DNS record, or request only example.com, and create a new order.
Exercise
Why does the ACME server need both an account key and a CSR key pair, and which one authorizes a revocation request?
Show answer
The account key signs ACME requests and identifies who is allowed to order, manage and revoke. The CSR key pair is the certificate's own key pair, used in TLS handshakes. Revocation can be authorized by the account key that owns the certificate, or by the certificate's private key.