cloudflare / circl

CIRCL: Cloudflare Interoperable Reusable Cryptographic Library
http://blog.cloudflare.com/introducing-circl
Other
1.23k stars 136 forks source link

KEM schemes need NewEmptyPublicKey and NewEmptyPrivateKey methods #389

Closed david415 closed 1 year ago

david415 commented 1 year ago

Dear circl devs,

I need a way to create empty public kyber kem keys so that I can initialize my data structures which encapsulate these keys and then unmarshal them from a binary blob. I feel like this is a fairly normal thing to do with cryptographic key material. Have I missed another obvious solution to this problem?

bwesterb commented 1 year ago

For those who wonder the same and don't figure it out themselves: an empty public key doesn't need to be initialized. Instead, to unmarshal a public key, simply call UnmarshalBinaryPublicKey() on the scheme, which returns the PublicKey object.