qserde
It is a non-std rust library for serializing/deserializing ml-kem(aka kyber) public key, encapsulating/decapsulating 256 bit keys and so on.
WARNING
Current version of ml-kem crate used in this crate does not support rand crate of 0.9.x versions, so if everything doesn't work maybe you should downgrade the rand crate version to at least 0.8.5
usage
Use generate_keypair{512/768/1024} to generate keypair, encapsulation key's functions to_bytes, from_bytes, encapsulate to do encapsulation, serialize and deserialize it. And decapsulate func of DecapsulationKey to decapsulate ciphertexts Here's usage example below:
use *;
let mut rng = thread_rng;
//generating ml_kem keypair of 1024-bit mode
let = generate_keypair1024;
//encapsulation key deserialized into bytes
let serialized_encapsulaion_key = ek.to_bytes;
//converting bytes into 1024-bit mode encapsulation key
let ek = from_bytes.unwrap;
//encapsulating random 32 bytes
let = ek.encapsulate.unwrap;
//decapsulating shared secret from ciphertext
let another_shared_secret = dk.decapsulate.unwrap;
assert_eq!;