liveBook · Manning

Public-private key pair

As explained in Real-World Cryptography

A key pair is a linked public key and private key used together in public-key cryptography.

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

How Real-World Cryptography covers it

How deep it goes
Explains generation, key roles, encryption, exchange, signing, and failure modes, while deferring detailed authentication protocols.
Examples
Uses Alice-and-Bob exchanges, Python Ed25519 signing, C session-key setup, and Bitcoin transfers as concrete examples.
What it assumes
Assumes authenticated encryption and key-exchange basics while teaching public and private key roles from first principles.
What you can do after
Apply key pairs to encrypt messages, derive shared secrets, verify signatures, and authorize Bitcoin transactions.
How it connects
Connects asymmetric encryption, key exchange, symmetric encryption, authenticated encryption, digital signatures, hybrid encryption, and Bitcoin.

Also explained in

Compare how 6 books explain public-private key pair →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Real-World Cryptography. The section links point to the parts of the book it draws on.