PKI and Certificates
Unit 2: Change Management and Cryptography. Lesson 8 of 54 in SecPlus Academy.
Asymmetric encryption only works if you can trust that a public key really belongs to who it claims. Public key infrastructure solves that with certificates: documents that bind a public key to an identity, signed by an authority everyone trusts.
The players
- Certificate authority (CA): issues and signs certificates. The CA's own certificate is the root of trust; operating systems and browsers ship with a list of trusted roots.
- Registration authority: verifies the identity of the requester before the CA issues anything.
- Intermediate CAs: sign day-to-day certificates so the root key can stay offline. A certificate chain runs leaf to intermediate to root.
Getting a certificate
- Generate a key pair on the server. The private key never leaves it.
- Create a certificate signing request (CSR) containing the public key and the identity details.
- The CA validates the request and returns a signed certificate.
- Install the certificate and the chain.
Revocation
A compromised or retired certificate must be revoked before it expires.
- CRL: a list of revoked serial numbers that clients download periodically. Simple, but can be hours stale.
- OCSP: the client asks the CA in real time about one certificate. OCSP stapling has the server fetch a signed OCSP response and include it in the TLS handshake, which is faster and more private.
Kinds of certificates
- Self-signed: signed by its own key, no CA. Browsers warn. Acceptable for internal test systems only.
- Third-party: issued by a public CA and trusted everywhere.
- Wildcard:
*.example.comcovers every host at one level of the domain. - Subject alternative name: several hostnames on one certificate.
- Code-signing, email, user, and device certificates use the same structure for different purposes.
Formats and escrow
- PEM: Base64 text, usually
.pemor.crt. DER: the same content in binary. - PFX or P12: a bundle that includes the private key, password protected. P7B: a chain of certificates with no private key.
- Key escrow: a trusted party keeps a copy of a private key so encrypted data can be recovered if the key is lost or an employee leaves.
PKI and Certificates, explained slowly
The problem PKI solves
Asymmetric encryption says "encrypt with the recipient's public key." Fine, but when a website hands your browser a public key, how do you know it belongs to your bank and not to an attacker sitting in the middle? You need someone you already trust to vouch for it. That is a certificate: the public key, the identity, and a signature from a trusted authority, all in one document.
The trust chain
Root CA (offline, in every browser's trust store) | signs Intermediate CA (online, does the daily work) | signs Leaf certificate (www.bank.example, public key, validity dates, purpose)
Your browser trusts the root because it shipped with it. The root signed the intermediate, the intermediate signed the bank's certificate, so the browser trusts the bank's public key. That is the root of trust and the chain. Keeping the root offline protects the whole system: if an intermediate is compromised, it can be revoked without replacing every browser's trust store.
The registration authority is the part of the CA's operation that checks identity before issuance: proving you control the domain, or for higher assurance, that the company exists.
Getting a certificate, in order
- On the server, generate a key pair. The private key never leaves the server.
- Build a certificate signing request (CSR): the public key plus the identity details, signed with the private key to prove you hold it.
- Send the CSR to the CA. The RA validates. The CA signs and returns the certificate.
- Install the certificate and the intermediate chain on the server.
If a question asks what is sent to the CA, the answer is the CSR containing the public key. Never the private key.
Revocation: CRL versus OCSP
Certificates expire, but sometimes they must die early: the private key leaked, or the server was retired.
CRL the CA publishes a list of revoked serial numbers; clients download it on a schedule
simple; can be hours or days stale; large lists
OCSP the client asks the CA "is this one certificate still good?" in real time
current; adds a round trip; reveals what sites you visit to the CA
OCSP stapling the server fetches a fresh signed OCSP answer and attaches it to the handshake
current and fast, no client round trip, no privacy leakKinds of certificates
- Self-signed: signed by its own private key. Nobody vouches for it, so browsers warn. Fine for an internal test box or a lab, never for users on the internet.
- Third-party: issued by a public CA; trusted automatically.
- Wildcard:
*.example.comcovers mail.example.com, www.example.com, any single label. Convenient; one compromised key affects every subdomain. - Subject alternative name (SAN): a list of specific hostnames on one certificate.
- Purpose-specific: code signing (proves software came from the publisher), email (S/MIME), user and device certificates for 802.1X.
Formats
PEM Base64 text between BEGIN and END lines; .pem, .crt, .cer certificate or key DER the same data in binary; .der, sometimes .cer certificate PFX/P12 a password-protected bundle WITH the private key; .pfx, .p12 moving a cert plus key P7B a chain of certificates, NO private key; .p7b distributing a chain
Key escrow
A trusted third party, often the organization itself, keeps a copy of private keys. If an employee leaves or loses a key, encrypted data can still be recovered. The trade-off is that the escrow becomes a high-value target and must be protected.
How the exam asks it
- "Users receive a certificate warning on the internal portal." Self-signed, or the intermediate chain is missing.
- "Check revocation status without downloading a large list." OCSP.
- "Improve performance of revocation checking on the server." OCSP stapling.
- "One certificate for all subdomains." Wildcard.
- "Export the certificate together with its private key." PFX or P12.
- "Recover files encrypted by a former employee." Key escrow.
What to memorize
- Chain: leaf, intermediate, root. Root is the trust anchor and stays offline.
- CSR carries the public key; the private key never leaves the server.
- CRL is a list, OCSP is a question, stapling is the answer attached in advance.