Public key infrastructure (PKI) is a system that enables the use of public key cryptography, which is a
method of encrypting and authenticating data using a pair of keys: a public key and a private key.
Public key cryptography can protect against man-in-the-middle (MITM) attacks, which are attacks
where an attacker intercepts and modifies the communication between two parties. PKI makes
public key cryptography feasible by providing a way to generate, distribute, verify, and revoke public
keys. PKI also uses digital certificates, which are documents that bind a public key to an identity, and
certificate authorities, which are trusted entities that issue and validate certificates. By using PKI, the
parties can ensure that they are communicating with the intended recipient and that the data has
not been tampered with by an attacker.
Reference:
What is Public Key Infrastructure (PKI)? - Fortinet
How is man-in-the-middle attack prevented in TLS? [duplicate]
A brief look at Man-in-the-Middle Attacks and the Role of Public Key Infrastructure (PKI)