简体   繁体   中英

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?

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);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM