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

Sources

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.

Knowledge check

  1. 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.
  2. 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.
  3. 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.

Related