Britannica Sources used in this answer

How can public-key cryptography provide secrecy for a message?

Created from Britannica articles using AI. AI can make mistakes, so verify using Britannica articles.

Public-key cryptography, also known as asymmetric encryption, provides secrecy by utilizing a pair of mathematically linked keys: a public key and a secret (private) key.12

In this system, a user publishes their encryption key in a directory accessible to anyone, while keeping their corresponding decryption key strictly private. When a sender wishes to transmit a message securely, they look up the recipient's public key and use it to encrypt the data. Because the resulting ciphertext can only be decrypted by the holder of the matching secret key, the message remains unintelligible to unauthorized parties, including those who may have access to the public key.12

This approach effectively solves the key distribution problem, as it eliminates the need for the sender and receiver to share a secret key beforehand. The security of the system relies on computational asymmetry, where it is easy to encrypt a message using the public key but computationally infeasible for an attacker to recover the original message or the secret key, even when the encryption algorithm and public key are known.12