How Certificate Transparency works: precertificates, SCTs and Merkle trees

From the certificate request to the browser check: the steps of Certificate Transparency, and the role played by logs, SCTs and monitors.

Published · 6 min read · Also available in: Français

A certificate authority can issue a certificate for any domain. If it is hacked or careless, traffic is still encrypted, but possibly with an attacker at the other end. Certificate Transparency (CT) was created so that this kind of issuance can no longer go unnoticed. We have already covered how to use it to find forgotten certificates; this article explains what happens under the hood.

The problem: who watches the authorities?

A certificate binds a public key to a domain name, much as a passport binds a photo to a name. The whole system rests on trust in certificate authorities (CAs): browsers and domain owners assume they tie each domain to the right owner.

For a long time, the only control was an audit by accredited third parties. Those audits look at the authority’s practices and track record, not at each certificate issued. A long time could pass between a wrongful issuance and the authority reacting to it.

Two cases showed where the model broke down:

Certificate Transparency is the answer to that opacity: make every issuance public and verifiable.

Three roles

Role What it does Examples
Logs Record certificates in an append-only register Google, Cloudflare (Nimbus), Let’s Encrypt (Oak), DigiCert, Sectigo
Monitors Read the logs and flag suspicious issuance crt.sh, Cert Spotter, Censys, Cloudflare
Browsers Reject certificates with no proof of logging Chrome, Safari

None of these roles is reserved: any organization with the means can run a log, and anyone can set up a monitor. The system holds because there are many logs, run by different organizations, in different jurisdictions.

Issuing a certificate, step by step

Site ownerCertificate authorityCT logsBrowser
  1. 1. Request (CSR) and proof of control
  2. 2. Creates the precertificate
  3. 3. Submits the precertificate
  4. 4. SCT: signed promise
  5. 5. Final certificate, SCTs included
  6. 6. TLS connection: certificate and SCTs presented
  7. Requires at least two SCTs
Steps 1 to 6 of issuance. Monitors (step 7) then read the logs.

1. The site owner requests a certificate

They generate a key pair and a certificate signing request (CSR), then prove to the authority that they control the domain, for example by creating a DNS record containing a random value.

2. The authority creates a precertificate

This is the subtle part of the protocol. The final certificate must contain proof that it was logged, but getting that proof requires submitting the certificate first. The precertificate breaks the loop: it holds the same information as the certificate, plus a “poison” extension that makes it unusable by a browser.

3. The precertificate is submitted to logs

Anyone can submit a certificate to a log; in practice most submissions come from authorities.

4. Each log answers with an SCT

The SCT (Signed Certificate Timestamp) is a signed promise: the log commits to including the certificate within a maximum delay, the MMD (Maximum Merge Delay), usually 24 hours. That delay keeps a log from blocking issuance and gives its operator time to fix an incident before being removed from the list of approved logs.

5. The authority issues the final certificate

It embeds the SCTs in an X.509v3 extension, signs the certificate and hands it to the owner. Two other delivery methods exist, less common: OCSP stapling and a TLS extension. In the usual case, nothing changes on the server: the SCTs travel with the certificate for its whole lifetime and are presented during the TLS handshake.

6. The browser checks

Chrome and Safari require at least two SCTs, more depending on the certificate’s lifetime. The number and choice of logs are set by each browser’s policy, not by the authority.

7. Monitors keep watch

Servers periodically query all the logs. A domain owner subscribed to a monitor is notified as soon as a precertificate or certificate appears for one of their names. Monitors also spot certificates with unusual extensions, such as those carrying certificate authority capabilities.

Why a log cannot cheat

A CT log is not a plain database: it is a Merkle tree.

Root H(ABCD), signed: STH H(AB) H(CD) H(A) certificate A H(B) certificate B H(C) certificate C H(D) certificate D
Each node is the hash of its two children: changing a single certificate changes the root.

The log regularly signs that root: this is the STH (Signed Tree Head). Changing, deleting or inserting a single certificate after the fact would change the root, and the tampering would show.

This structure allows two cheap checks, without downloading the whole log:

A log that showed two different versions of its content to two observers ends up exposed. It has happened: in May 2016, the Spanish operator Izenpe reused its production log signing key in a test environment, which produced two diverging views. The log was disqualified.

A ten-year rollout

No single party could impose CT on the whole Internet at once without breaking many sites. The rollout was therefore gradual:

What CT has made it possible to detect

The project lists several cases where the logs exposed faulty practices:

In each case, the evidence was public and verifiable by anyone.

What this means for you

Source: certificate.transparency.dev, the Certificate Transparency project site.