liveBook · Manning

Key exchange

As explained in Real-World Cryptography

A key exchange is a cryptographic protocol in which parties establish a common secret without directly transmitting that secret.

A key exchange lets two parties establish the same secret without sending that secret directly. They can then use it as a key for authenticated encryption. section 1.4.1 section 5.0

A Diffie-Hellman-style exchange follows a short sequence:

  • Agree on common public parameters. section 1.4.1
  • Generate a private key and a corresponding public key on each side. section 5.1
  • Exchange only the public keys; observers may see them. section 5.1
  • Combine the peer’s public key with the local private key to derive the same shared secret. section 1.4.1 section 5.1

Alice and Bob against a snooper

Alice and Bob have never spoken but want private communication. Sending a symmetric key directly would expose it to a passive snooper. A key exchange gives both parties a shared key that the snooper cannot reproduce from the public exchange alone, allowing subsequent authenticated encryption. section 5.1

Confidentiality against passive observation is not authentication. An active man-in-the-middle can replace public keys, impersonate both parties, and create two separate exchanges. Authentication, mutual authentication, known public keys, or signatures are needed to address that threat. section 5.1 section 5.5

Diffie-Hellman remains widely used. ECDH offers smaller keys than traditional DH, while asymmetric encryption can also encapsulate a generated symmetric key. RSA-based exchange is less preferred than ECDH, and Kyber provides a lattice-based alternative still described at the level of ideas and intuition. section 5.5 section 6.2.1 section 14.3.3

How Real-World Cryptography covers it

How deep it goes
Explains key-pair generation, public-key exchange, shared-secret derivation, and MITM limits, while deferring detailed mathematics.
Examples
Uses Alice-and-Bob exchanges, private and public shapes, passive and active MITM scenarios, C code, RSA encapsulation, and Kyber intuition.
What it assumes
Assumes message authentication codes and authenticated encryption, while introducing asymmetric cryptography through concrete scenarios and analogies.
What you can do after
Apply it by deriving a shared secret for authenticated encryption while distinguishing passive observation from active impersonation.
How it connects
Connects asymmetric cryptography, symmetric encryption, authenticated encryption, digital signatures, RSA, Diffie-Hellman, and elliptic-curve cryptography.

Also explained in

Compare how 2 books explain key exchange →

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.