4 Key exchange using elliptic curves
Elliptic-curve key exchange is presented as a way for two parties to derive a shared secret without ever sending that secret directly. The chapter builds on the basic point addition and multiplication routines introduced earlier, showing how a private key can be treated as a large integer and a public key as a curve point. A secure curve with a large prime-order subgroup and a chosen base point provides the public parameters, while the security rests on the difficulty of recovering the private scalar from a public point.
The simpler approach described is elliptic-curve Diffie-Hellman. Each participant generates a private value, multiplies it by the base point to create a public key, and exchanges those public keys. Then each side multiplies the other side’s public point by its own private scalar, producing the same shared point because scalar multiplication on the curve is commutative in this setup. The x-coordinate of that shared point is used as input material for a symmetric cipher key, and the chapter also explains how a hash function can turn arbitrary text or pass phrases into valid field elements for key generation.
The chapter then moves to the more robust MQV family, specifically Full ECC MQV. In addition to static keys, each side creates a fresh ephemeral key for every session, which improves security and provides stronger forward secrecy. The NIST-style procedure combines the ephemeral and static secrets through an associate value function, computes an intermediate point from the other party’s public data, and then derives the final shared secret from a further scalar multiplication, optionally multiplying by the curve cofactor. Example code and test routines show that both sides arrive at the same shared value for both Diffie-Hellman and MQV, confirming the mathematics and illustrating how the algorithms fit into practical implementations.
Creating a shared secret key by exchanging public keys
Summary
- In elliptic curve key exchange, both sides compute the same point and use the \(x\) value for the shared secret.
- Diffie-Hellman uses one person’s private key and another person’s public key to create a shared secret key. The secret key is used with a standard single-key encryption algorithm.
- A hash function can be used to generate random bits from a text phrase. This creates a private key that does not require storage. The public key, private key pair is always the same for a given curve and base point.
- The Menezes-Qu-Vanstone (MQV) algorithm uses ephemeral private, public keys in addition to the users’ static private key, public key pairs to create perfect forward secrecy.
- The NIST version of MQV includes an associate value function that outputs half an \(x\) value.
- MQV combines two private keys and two public keys that are multiplied to form a shared secret point. The \(x\) value is then used as the shared secret key.
- Once the ephemeral keys are created, they must be communicated between both sides. The actual calculations are quick.
Elliptic Curve Cryptography for Developers ebook for free