Encryption is useful only when a client knows whose public key it is using.
Suppose a client connects to api.example.com and receives a public key. The client can use that key as part of a secure protocol, but an attacker in the middle could substitute another public key. The traffic would still be encrypted—just to the attacker.
A digital certificate addresses this identity problem. It is a signed data structure that associates an identity, such as api.example.com, with a public key. Public Key Infrastructure, or PKI, is the wider system that issues certificates, establishes which issuers are trusted, distributes status information, and manages certificates throughout their lifetimes.
For HTTPS, the practical questions are:
This chapter develops the certificate and PKI model behind those decisions and shows how engineers issue, deploy, inspect, and rotate certificates in real systems.