pub struct MlKem1024;Expand description
ML-KEM-1024 KEM marker type implementing [quantaegis_core::Kem].
Implementations§
Source§impl MlKem1024
impl MlKem1024
Sourcepub fn keygen_into<R: CryptoRng + ?Sized>(
rng: &mut R,
ek_out: &mut EncapsulationKey,
dk_out: &mut DecapsulationKey,
) -> Result<()>
pub fn keygen_into<R: CryptoRng + ?Sized>( rng: &mut R, ek_out: &mut EncapsulationKey, dk_out: &mut DecapsulationKey, ) -> Result<()>
Generates a fresh key pair directly into caller-owned storage without creating
serialized stack copies of the decapsulation key (FIPS 203, Algorithm 19).
Sourcepub fn encaps_into<R: CryptoRng + ?Sized>(
ek: &EncapsulationKey,
rng: &mut R,
ct_out: &mut Ciphertext,
ss_out: &mut SharedSecret,
) -> Result<()>
pub fn encaps_into<R: CryptoRng + ?Sized>( ek: &EncapsulationKey, rng: &mut R, ct_out: &mut Ciphertext, ss_out: &mut SharedSecret, ) -> Result<()>
Encapsulates directly into caller-owned ct_out and ss_out without leaving
an unwiped stack copy of the shared secret (FIPS 203, Algorithm 20).
Sourcepub fn decaps_into(
dk: &DecapsulationKey,
ct: &Ciphertext,
ss_out: &mut SharedSecret,
) -> Result<()>
pub fn decaps_into( dk: &DecapsulationKey, ct: &Ciphertext, ss_out: &mut SharedSecret, ) -> Result<()>
Decapsulates directly into caller-owned ss_out without leaving an unwiped
stack copy of the shared secret (FIPS 203, Algorithm 21).
Returns [Error::InvalidDecapsulationKey] if dk is an uninitialized or
zeroized placeholder.
Trait Implementations§
Source§impl Kem for MlKem1024
impl Kem for MlKem1024
Source§fn keygen<R: CryptoRng + ?Sized>(
rng: &mut R,
) -> Result<(Self::EncapsulationKey, Self::DecapsulationKey)>
fn keygen<R: CryptoRng + ?Sized>( rng: &mut R, ) -> Result<(Self::EncapsulationKey, Self::DecapsulationKey)>
Generates a fresh key pair (FIPS 203, Algorithm 19: ML-KEM.KeyGen()).
Note: returning secret key material by value in safe Rust can leave an
unzeroized copy in the callee’s return staging slot; FIPS/zeroization-critical
callers should use keygen_into directly into caller-owned storage.
Source§fn encaps<R: CryptoRng + ?Sized>(
ek: &Self::EncapsulationKey,
rng: &mut R,
) -> Result<(Self::Ciphertext, Self::SharedSecret)>
fn encaps<R: CryptoRng + ?Sized>( ek: &Self::EncapsulationKey, rng: &mut R, ) -> Result<(Self::Ciphertext, Self::SharedSecret)>
Encapsulates a shared secret to ek (FIPS 203, Algorithm 20: ML-KEM.Encaps()).
Note: returning SharedSecret by value in safe Rust can leave an unzeroized
copy in the callee’s return staging slot; FIPS/zeroization-critical callers
should use encaps_into directly into caller-owned storage.
Source§fn decaps(
dk: &Self::DecapsulationKey,
ct: &Self::Ciphertext,
) -> Result<Self::SharedSecret>
fn decaps( dk: &Self::DecapsulationKey, ct: &Self::Ciphertext, ) -> Result<Self::SharedSecret>
Decapsulates ct using dk (FIPS 203, Algorithm 21: ML-KEM.Decaps()).
Note: returning SharedSecret by value in safe Rust can leave an unzeroized
copy in the callee’s return staging slot; FIPS/zeroization-critical callers
should use decaps_into directly into caller-owned storage.