PKI works through a combination of public and private keys. A public key is shared openly, while a private key is kept secret. When data is encrypted with a public key, only the matching private key can decrypt it. This mechanism ensures that sensitive information is protected from unauthorized access. PKI also involves the use of digital certificates issued by a trusted Certificate Authority (CA), which verifies the identity of the certificate holder.