openssl / openssl

TLS/SSL and crypto library

Home Page:https://www.openssl.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Missing function to get compressed public EC key

SmallLars opened this issue · comments

Considering the docs I am able to get the encoded public key from an EVP_PKEY with EVP_PKEY_get1_encoded_public_key. In case of an EC key it is something like 0x04 x y.

EVP_PKEY_set1_encoded_public_key also allows to use the compressed form 0x02 x or 0x03 x.

But currently there is no way to request the compressed form without deprecated API.
EC_KEY_get0_public_key provided an EC_POINT where EC_POINT_point2oct could be used with POINT_CONVERSION_COMPRESSED or POINT_CONVERSION_UNCOMPRESSED.