Vega4
Vega4

Reputation: 989

Botan library and 'compressed' public keys

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

Answers (1)

Jack Lloyd
Jack Lloyd

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

Related Questions