Overview

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
figure

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.

FAQ

What is the main goal of elliptic curve key exchange in this chapter?The goal is to let two parties create a shared secret that no one else can compute, using their private keys and exchanged public keys. That shared secret can then be used as the key for a symmetric cipher such as AES.
How does elliptic curve Diffie-Hellman create a shared secret?Each party multiplies their private key by the other party’s public key. Because elliptic curve multiplication is commutative in this context, both sides compute the same shared point S, and they use its x-coordinate as the shared secret.
Why is the x-coordinate of the shared point used as the secret key?The shared point S is a point on the curve, but symmetric algorithms need a fixed-size secret value. The x-coordinate, or a portion of its bits, is used as a practical secret key for encryption.
What makes elliptic curve discrete log hard to solve?Given a base point G and a public point A = kA G, it is computationally infeasible to recover the private scalar kA. This is the elliptic curve discrete log problem, and its difficulty is what provides security.
Why does the chapter recommend using a secure curve with prime order?A prime-order curve makes the group structure simpler and avoids cofactors in the basic case. That means every point can act as a generator, and attackers have no shortcut other than examining the full group.
What is the purpose of hashing a pass phrase into a private key?A hash function turns an arbitrary-length pass phrase into a fixed-size integer that can serve as a private key. This avoids storing the private key directly and allows the key to be regenerated when needed.
What does the hash-to-finite-field routine do?It takes an input string, hashes it with KangarooTwelve, converts the output into an integer, and reduces it modulo the curve order. It also uses a domain separation tag so the same hash function can be used safely in different contexts.
How is an MQV exchange different from basic Diffie-Hellman?MQV uses both static keys and ephemeral keys, while Diffie-Hellman uses only static public/private key pairs. The ephemeral keys change every session, which improves security and supports stronger forward secrecy.
What is the associate value function in MQV?The associate value function, or avf(), takes an x-coordinate, keeps the lower half of its bits, and sets one bit at the halfway point. NIST uses this value in MQV to mix the ephemeral public key into the key agreement calculation.
Why does MQV require more communication than Diffie-Hellman?Because both sides must exchange their ephemeral public keys in addition to their static public keys. This extra data is needed so each side can compute the MQV shared secret for that specific session.

pro $24.99 per month

  • access to all Manning books, MEAPs, liveVideos, liveProjects, and audiobooks!
  • choose one free eBook per month to keep
  • exclusive 50% discount on all purchases
  • renews monthly, pause or cancel renewal anytime

lite $19.99 per month

  • access to all Manning books, including MEAPs!

team

5, 10 or 20 seats+ for your team - learn more


Close
choose your plan

team

monthly
annual
$49.99
$499.99
only $41.67 per month
  • five seats for your team
  • access to all Manning books, MEAPs, liveVideos, liveProjects, and audiobooks!
  • choose another free product every time you renew
  • choose twelve free products per year
  • exclusive 50% discount on all purchases
  • renews monthly, pause or cancel renewal anytime
  • renews annually, pause or cancel renewal anytime
  • Elliptic Curve Cryptography for Developers Elliptic Curve Cryptography for Developers ebook for free
Close
choose your plan

team

monthly
annual
$49.99
$499.99
only $41.67 per month
  • five seats for your team
  • access to all Manning books, MEAPs, liveVideos, liveProjects, and audiobooks!
  • choose another free product every time you renew
  • choose twelve free products per year
  • exclusive 50% discount on all purchases
  • renews monthly, pause or cancel renewal anytime
  • renews annually, pause or cancel renewal anytime
  • Elliptic Curve Cryptography for Developers Elliptic Curve Cryptography for Developers ebook for free
Close
choose your plan

team

monthly
annual
$49.99
$499.99
only $41.67 per month
  • five seats for your team
  • access to all Manning books, MEAPs, liveVideos, liveProjects, and audiobooks!
  • choose another free product every time you renew
  • choose twelve free products per year
  • exclusive 50% discount on all purchases
  • renews monthly, pause or cancel renewal anytime
  • renews annually, pause or cancel renewal anytime
  • Elliptic Curve Cryptography for Developers Elliptic Curve Cryptography for Developers ebook for free