A public–private key pair links two different cryptographic keys. The public key can be shared openly; the private key must remain secret. A key-generation algorithm creates both, using a security parameter that determines the intended security strength. section 6.1
The same pair supports several practical jobs:
- Encrypt messages to a recipient with the recipient’s public key; only the associated private key can decrypt them. section 6.1
- Create a shared secret during a key exchange by combining your private key with your peer’s public key; the peer performs the complementary operation. section 5.1
- Sign data with the private key and verify the signature with the public key. section 7.1.1
A key exchange in practice
Alice and Bob generate pairs, exchange only their public keys, and derive the same shared secret from the received public key and their own private key. They can then use that secret with authenticated encryption. Passive observers cannot reproduce the secret from the exchanged public keys alone, but an active man-in-the-middle can impersonate both sides if the public keys are not authenticated. section 5.1 section 1.4.1
Figure 5.1 A key exchange provides the following interface: it takes your peer’s public key and your private key to produce a shared secret. Your peer can obtain the same shared secret by using your public key and their private key.
Use the interface diagram to track how one participant’s private key and the peer’s public key produce a shared secret, with the roles reversed on the other side. section 5.1
Public visibility does not prove ownership. Encryption to an unverified public key may reach the wrong party, and an unauthenticated exchange permits impersonation. Protecting the private key is equally critical: in Bitcoin, control of funds depends directly on it. section 6.1 section 12.2.1





