3

As far as I understand, x25519 DH function used on Curve25519 uses only Xcoordinates as I can read in the wikipedia definition:

The protocol uses compressed elliptic point (only X coordinates), so it allows efficient use of the Montgomery ladder for ECDH, using only XZ coordinates.[5]

XZ coordinates [database entry] represent x y as X Z satisfying the following equations:

x=X/Z

according to this documentation.

I found these equations in this stack exchange answer:

enter image description here

enter image description here

enter image description here

I've looked at the X25519_public_from_private function and found:

    /*
     * We only need the u-coordinate of the curve25519 point.
     * The map is u=(y+1)/(1-y). Since y=Y/Z, this gives
     * u=(Z+Y)/(Z-Y).
     */

What I'd like to know is how to create a public key from u,v or x,y (or X,Y) coordinates. And especially if it is even possible?

For example, with classic ecdsa, one can create public numbers thanks to the x,y coordinates and the curve hence create a public key from them.
Example using cryptography python library:

public_numbers = ec.EllipticCurvePublicNumbers(x, y, curve)
public_key = public_numbers.public_key(backend)

I'd like to achieve the same thing with Curve25519.

References:
https://medium.com/@chain_66731/a-deep-dive-into-x25519-7a926e8a91c7
https://hackernoon.com/what-is-the-math-behind-elliptic-curve-cryptography-f61b25253da3
https://crypto.stackexchange.com/questions/74598/key-specifications-for-x25519-need-two-clarifications-please

Guillaume Cisco
  • 2,859
  • 24
  • 25
  • 2
    *What I'd like to know is how to create a public key from u,v or x,y (or X,Y) coordinates...* Those are already public keys. This question seems more crypto than programming and probably should be asked in [crypto](https://crypto.stackexchange.com/). – President James K. Polk Dec 24 '19 at 23:39
  • @JamesReinstateMonicaPolk, You're telling me all are already public keys, but which abscissa should I use? x ? X ? u ? How to convert this abscissa coordinate to a python object representing a public key? The exchange key protocol code for x25519 getting abscissa coordinate can be found here: https://github.com/openssl/openssl/blob/master/crypto/ec/curve25519.c#L686 – Guillaume Cisco Dec 30 '19 at 16:54

0 Answers0