Cyber Trainer Crypto Primer
Crypto Primer · Chapter 06

PKI & certificates

Public-key crypto has one big gap: when you download someone's public key, how do you know it's really theirs and not an attacker's? Public Key Infrastructure (PKI) closes that gap by having trusted third parties vouch for keys.

Digital signatures

PKI is built on signatures, so start there. To sign a message:

  1. Hash the message (for example with SHA-256) to get a short fingerprint.
  2. Sign the hash with your private key.
  3. Send the message plus the signature.

The receiver hashes the message themselves and uses your public key to check the signature matches. If even one bit of the message changed, or a different key made the signature, verification fails. That gives integrity, authentication and non-repudiation.

Common mix-upYou encrypt with the recipient's public key, so only they can read it. You sign with your own private key, so anyone can verify it came from you.
Sign and verify (ECDSA P-256)

Public key (shareable, JWK coordinates)

-

Signature

-

The parts of a PKI

ComponentRole
Certificate Authority (CA)A trusted organisation that checks identities and signs certificates. Root CAs sit at the top and are usually kept offline. Intermediate (issuing) CAs do the day-to-day signing, so the root key is rarely exposed.
Registration Authority (RA)Checks the requester's identity on the CA's behalf. It can't sign certificates itself.
Digital certificate (X.509)A signed document that binds a public key to an identity (a domain, person or device) for a set period.
CSR (Certificate Signing Request)What you send the CA: your public key plus identity details, signed with your private key to prove you hold it. The private key never leaves you.
Trust storeThe list of root certificates your OS or browser trusts out of the box (Microsoft, Apple, Mozilla and Chrome each run a root programme).
CRL (Certificate Revocation List)A signed list of revoked serial numbers that the CA publishes regularly.
OCSPOnline Certificate Status Protocol: a real-time "is this certificate still good?" lookup. OCSP stapling lets the server attach a recent response itself. Because of privacy and reliability problems, OCSP is in decline. The CA/Browser Forum made it optional in 2023 and Let's Encrypt switched it off in August 2025 in favour of CRLs.
CP / CPSCertificate Policy and Certification Practice Statement: the CA's published rules and procedures.
HSMHardware Security Module: tamper-resistant hardware that stores CA private keys.
Key escrow / recoveryA trusted copy of (usually encryption) keys so data can be recovered if a key is lost. Signing keys should never be escrowed, or you lose non-repudiation.

Anatomy of an X.509 certificate

Every HTTPS site sends one of these. Click the padlock in your browser's address bar and look at the certificate details to see a real one. An illustrative example:

📄 cybertrainer.uk (illustrative)
Version
3 (X.509 v3)
Serial number
04:a1:7f:2c:93:5e:…
Signature alg.
ecdsa-with-SHA384
Issuer
CN=Example Issuing CA E1, O=Example Trust Ltd, C=GB
Valid from / to
2026-11-01 → 2027-05-19 (≤ 200 days)
Subject
CN=cybertrainer.uk
Public key
EC P-256: 04:6b:17:d1:f2:e1:2c:42:…
Subject Alt Names
DNS:cybertrainer.uk, DNS:*.cybertrainer.uk
Key usage
Digital Signature
Extended key usage
TLS Web Server Authentication
Basic constraints
CA:FALSE
CRL distribution
http://crl.example-trust.test/e1.crl
SCTs
2 × Certificate Transparency log timestamps
CA signature
30:45:02:21:00:b8:…

Browsers check the Subject Alternative Name (SAN), not the Common Name, against the site you visited. A wildcard (*.cybertrainer.uk) covers one level of subdomain, such as scamcheck.cybertrainer.uk, but not the bare domain or deeper levels. That's why the bare domain is usually listed too.

The chain of trust

Your browser doesn't trust a site's certificate directly. It follows a chain: the leaf (site) certificate is signed by an intermediate, which is signed by a root that's already in the trust store. If every link checks out, the padlock appears. Break any one and you get a warning.

Break the chain

Introduce a fault:

What the browser checks:

Types of certificate

DV / OV / EV

Domain, Organisation or Extended Validation, depending on how much the CA checked. All three give the same encryption. Browsers no longer show EV differently, so DV (for example from Let's Encrypt or Cloudflare) is now standard for most sites.

Wildcard and SAN (multi-domain)

One certificate covering *.example.com, or a list of names.

Self-signed

Signed by its own key, so there's no third party vouching for it. Fine for labs and internal tests, but it triggers browser warnings and teaches users to click through them.

Client and device

Used for mutual TLS (mTLS), 802.1X/EAP-TLS Wi-Fi, VPNs and zero-trust access. Cloudflare Access can require them.

Code signing

Proves software came from the publisher and hasn't been altered.

S/MIME (email)

Signs and/or encrypts email messages end to end.

Certificate lifecycle and today's rules

1Generate key pair
→
2Create CSR
→
3CA validates
→
4Issue and log in CT
→
5Deploy
→
6Renew / revoke / expire
  • Shorter lifetimes: under CA/Browser Forum ballot SC-081v3, the maximum lifetime of public TLS certificates dropped from 398 to 200 days on 15 March 2026. It falls to 100 days in March 2027 and 47 days in March 2029. Shorter certificates limit the damage from a stolen key and reduce reliance on revocation.
  • Automation (ACME): with lifetimes this short, manual renewal isn't practical. The ACME protocol (RFC 8555), used by Let's Encrypt, certbot and Cloudflare's edge certificates, handles validation and renewal automatically.
  • Certificate Transparency (CT): every publicly trusted certificate must be logged in public, append-only logs before browsers accept it. Anyone can watch for certificates issued for their domain. Try searching for your domain on crt.sh.
  • CAA DNS records let a domain owner list which CAs may issue for it. Worth adding in your Cloudflare DNS.
When PKI fails In 2011 the Dutch CA DigiNotar was hacked and fake certificates were issued for google.com and others, then used to spy on users. All of DigiNotar's roots were removed from trust stores and the company went bankrupt. A CA is only as trustworthy as its security, which is why Certificate Transparency now exists.

Other trust models

  • Hierarchical (CA-based): the model used by the web and described above.
  • Web of trust: PGP/GPG users sign each other's keys. It's decentralised but hard to scale.
  • Trust on first use (TOFU): SSH remembers a server's key the first time you connect and warns you if it changes.
  • Cross-certification / bridge CAs: separate PKIs agree to trust each other, which is common in government.

Knowledge check