[openssl-users] What does EC_KEY_get0_public_key deliver?
Matt Caswell
matt at openssl.org
Thu Jan 8 21:43:15 UTC 2015
On 08/01/15 17:16, Christian Weber wrote:
> Dear OpenSSL-Users,
>
> recently i found a pitfall using EC_KEY_get0_public_key(key->pkey.ec).
> The function just returns a copy to a pointer to key->pub_key which is a
> EC_POINT pointer.
> The key itself is taken from a certificate using EVP_PKEY *key =
> X509_get_pubkey(cert);
>
> Fine, i assumed, these must be coordinates of the publich key in the
> elements X and Y!
> Both are BIGNUMS as expected.
How are you accessing the elements X and Y? The internal representation
could be transformed and you should make sure you are using the correct
functions to access them, i.e. one of:
EC_POINT_get_affine_coordinates_GFp
or
EC_POINT_get_affine_coordinates_GF2m
Which one to use depends on whether you are using a prime or binary curve.
Matt
More information about the openssl-users
mailing list