Compute EC_KEY starting from X or Y coordinate only

Billy Brumley bbrumley at gmail.com
Fri Oct 25 10:02:37 UTC 2019


> Thank you! I thought they were the same.
>
> And given an x-only coordinate, how can I find the y coordinate? I
> don't find the relative functions on the documentation.

Well it depends on what you mean. Internally,
EC_POINT_set_compressed_coordinates_GFp will internally automatically
compute the y coordinate based on the y_bit argument.

EC_POINT_set_compressed_coordinates_GFp(group, p, x, 0, ...
EC_POINT_get_affine_coordinates_GFp(group, p, X0, Y0 ...

That will get you one of the points in X0, Y0.

EC_POINT_set_compressed_coordinates_GFp(group, p, x, 1, ...
EC_POINT_get_affine_coordinates_GFp(group, p, X1, Y1 ...

That will get you the other point in X1, Y1. (Where X0 = X1 = x.)

(But you are probably looking to do something cryptographically
interesting between set/get, which is application specific.)

Generally, in addition to the man pages which you seem to have found,
check the "tests" folder if you are looking for examples to get
started.

BBB


More information about the openssl-users mailing list