Certificates, TLS and looking after keys
Unit 5 of 5 in Cryptography basics.
You will be able to read a TLS certificate and explain how trust, lifetime and key care fit together.
Lesson
How a browser knows who it is talking to
A public key is just a number. How do you know it belongs to the site you meant? The X.509 certificate profile answers: public key certificates are data structures that bind public key values to subjects. The binding is asserted by having a trusted certificate authority (CA) digitally sign each certificate. A certificate has a limited valid lifetime, which is indicated in its signed contents.
So a certificate says: this key belongs to this name, signed by someone you already trust, valid between these dates. Clients keep a trust store of the CAs they accept, and OWASP's key management guidance has a section on managing trust stores.
TLS uses certificates for authentication
TLS 1.3 aims to give a secure channel with authentication, confidentiality and integrity. The server side is always authenticated, and authentication can use asymmetric cryptography such as RSA or elliptic-curve signatures. In the handshake, the server sends its certificate and proves it holds the matching private key, then both sides move to encrypted traffic.
What goes wrong in practice
OWASP's TLS guidance covers server configuration, such as supporting only strong protocols and ciphers and patching cryptographic libraries, and certificate hygiene: use strong keys and protect them, use correct domain names, think carefully about wildcard certificates, and use CAA records to restrict which CAs may issue for your domain.
Expiry is an ordinary, avoidable failure. Because a certificate has a limited lifetime, someone must renew it in time or clients will reject it. The labs show how to automate renewal and how to monitor expiry so it never surprises you.
Looking after keys
Every system in this class depends on a key staying secret. OWASP's key management guidance says to document and harmonize rules for the whole key life cycle (generation, distribution, destruction), for compromise, recovery and zeroization, for storage and for agreement. If a private key is ever copied, treat it as compromised: replace it and revoke the certificate that carried it.
Key points
- A certificate binds a public key to a name and is signed by a trusted CA, with a limited lifetime.
- TLS always authenticates the server; certificates are how.
- Common failures: expired certificates, weak configuration, careless wildcards.
- Plan the key life cycle; treat a copied private key as compromised.
Sources
- RFC 5280: Internet X.509 Public Key Infrastructure Certificate and CRL Profile
- RFC 8446: The Transport Layer Security (TLS) Protocol Version 1.3
- OWASP Transport Layer Security Cheat Sheet
- OWASP Key Management Cheat Sheet
Lecture
PKI and TLS in practice: A talk that walks through certificate chains, expiry and revocation as an engineer meets them.
Practice in the labs
Read a real certificate, automate issuing and renewing one, and practise revoking one.
- Inspect a website's TLS certificate: You read a live site's certificate with a command and learn every field that matters.
- Automate TLS certificates with ACME (locally, no public domain): You automate certificate issuing locally, which removes the most common failure, a forgotten renewal.
- Revoke a certificate: CRL and OCSP: You revoke a certificate and watch verification fail, the answer to 'what if the key leaks'.
Knowledge check
- What does a certificate do? Answer: Binds a public key to a subject, with the binding signed by a trusted CA. RFC 5280: public key certificates bind public key values to subjects, and the binding is asserted by a trusted CA signing the certificate.
- Why do expired certificates cause outages? Answer: They have a limited lifetime, so someone must renew them in time. A certificate has a limited valid lifetime indicated in its signed contents (RFC 5280); a forgotten renewal means clients reject it.
- A private key was copied from a server. What should you do? Answer: Treat it as compromised, replace the key and revoke the certificate. A leaked private key lets someone impersonate the server, so you must replace it and revoke the certificate, as key management guidance on compromise and recovery says.
Back to the syllabus or see all classes.