Reputation: 989
Does Botan support serialisation / deserialisation of a 'compressed' representation of an EC public key? (only X coordinate of the point on EC + sign). Any example?
Upvotes: 1
Views: 249
Reputation: 8405
Yes. Botan compresses ECC points by default eg when serializing a public key to X.509 format. It accepts compressed or uncompressed points. Given an ECC point, you can convert it to an octet string in compressed form with
const PointGFp& pt = my_ecc_key.public_point();
secure_vector<uint8_t> uncompressed_point = EC2OSP(pt, PointGFp::UNCOMPRESSED);
secure_vector<uint8_t> compressed_point = EC2OSP(pt, PointGFp::COMPRESSED);
Upvotes: 1