[openssl-users] Access to ECC X and Y

Matt Caswell matt at openssl.org
Tue May 31 19:58:43 UTC 2016



On 31/05/16 20:46, Chris Bare wrote:
> Is there a public interface to access the X and Y elements of an Ecc
> public key?
> I tried:
> 
> EC_KEY *ecc;
> 
> BN_num_bytes (ecc->pub_key->X);
> 
> but get the compiler error:
> 
> error: dereferencing pointer to incomplete type ‘EC_KEY {aka struct
> ec_key_st}’

You can obtain the public key using EC_KEY_get0_public_key() and then
you can access the x and y co-ords using
EC_POINT_get_affine_coordinates_GFp() (or
EC_POINT_get_affine_coordinates_GF2m() if using a binary curve).

Matt


More information about the openssl-users mailing list