Diffie–Hellman key exchange lets two parties derive the same secret without transmitting it directly. In elliptic-curve use, each party combines a private scalar with the other party’s public point; both obtain the same shared point and use its x value as a symmetric-encryption key. section 4.0 section 4.5
The elliptic-curve exchange proceeds as follows:
- Choose a curve, finite-field parameters, and a base point. section 4.3
- Create each private key as a large integer; a hash of a pass phrase can generate one without storing the phrase. section 4.0 section 4.5
- Derive and exchange public points. section 4.1
- Multiply each private key by the other party’s public point, then use the resulting point’s x value as the shared secret. section 4.1 section 4.5
Figure 4.1 Creating a shared secret key by exchanging public keys
Use the diagram to trace the two public-key transmissions and the converging calculations that produce one shared secret. section 4.1
Testing both sides
A test program computes myshare from one private key and the other public key, then computes theirshare using the reverse pairing. Comparing the two multiprecision results should print “Keys match.” The test verifies the mathematics but does not transmit keys over a network. section 4.3.2



