# Compute EC_KEY starting from X or Y coordinate only

Thulasi Goriparthi thulasi.goriparthi at gmail.com
Sat Oct 26 11:41:09 UTC 2019

```Call to EC_POINT_set_compressed_coodinates() with with x-coordinate and
y-bit will resolve the curve equation for y and chooses y out of two
possible y values based on y-bit input.

You can retrieve the x and y co-ordinates using
EC_POINT_get_affine_coordinates as below, where x-cordinate matches with

EC_POINT_get_affine_coordinates(group, ec_pub_key, bn_x, bn_y, NULL);

Thanks,
Thulasi.

On Sat, 26 Oct 2019 at 13:21, Luca Di Mauro <luca.dimauro at cnit.it> wrote:

> I checked the 'test' folder but I didn't found any tests that help me
> in this case.
>
> However the only doubt is how I can use the API offered by openssl library.
> I understand how retreive a point (and consequently to assign it to a
> public key) starting from a compressed-y representation (which belongs
> to this standard
> https://tools.ietf.org/id/draft-jivsov-ecc-compact-05.html).
>
> My doubt now is how to obtain a point (x,y) given the coordinate,
> which means resolve the equation y^2= x^3 + ax + b.
> Can you give me some tips to found a solution?
>
> Luca
>
> Billy Brumley <bbrumley at gmail.com> ha scritto:
>
> >> If I have an x-point which follows this representation
> >> https://tools.ietf.org/id/draft-jivsov-ecc-compact-05.html (so it is
> >> composed by 33 byte and first byte is '0x02') and I use
> >> 'EC_POINT_set_compressed_coordinates_GFp' function, it will be
> >> considered as compressed-y-0 or compressed-y-1? Or it is correctly
> >> considered as the x coordinate?
> >
> > What you are saying and what you are doing are two different things.
> >
> > Your code is at a very low level.
> >
> > Above this there is some encoding of points, depending on any number
> > of standards. OpenSSL implements some of them, but at a higher level.
> >
> > The low level API you're talking about provides maximum flexibility to
> > map that high level encoding in to the API's "x-coord + y-bit"
> > concept. It's up to you to figure out the details. (Including
> > determining if the encoding in OpenSSL matches what's expected in your
> > spec.)
> >
> > You need to play around a bit with the lib -- you can't expect this
> > list to interpret the standard for you. Check the "test" folder for
> > sample code.
> >
> > BBB
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mta.openssl.org/pipermail/openssl-users/attachments/20191026/56585716/attachment-0001.html>
```