pub struct MLKEMSeedPrivateKey<const k: usize, const eta1: i16, const LAMBDA: i16, const SK_LEN: usize, const FULL_SK_LEN: usize, const PK_LEN: usize, const T_PACKED_LEN: usize> { /* private fields */ }Expand description
An ML-KEM private key.
Implementations§
Source§impl<const k: usize, const eta1: i16, const LAMBDA: i16, const SK_LEN: usize, const FULL_SK_LEN: usize, const PK_LEN: usize, const T_PACKED_LEN: usize> MLKEMSeedPrivateKey<k, eta1, LAMBDA, SK_LEN, FULL_SK_LEN, PK_LEN, T_PACKED_LEN>
impl<const k: usize, const eta1: i16, const LAMBDA: i16, const SK_LEN: usize, const FULL_SK_LEN: usize, const PK_LEN: usize, const T_PACKED_LEN: usize> MLKEMSeedPrivateKey<k, eta1, LAMBDA, SK_LEN, FULL_SK_LEN, PK_LEN, T_PACKED_LEN>
Sourcepub fn new(seed: &KeyMaterial<64>) -> Result<Self, KEMError>
pub fn new(seed: &KeyMaterial<64>) -> Result<Self, KEMError>
Create a new MLKEMSeedPrivateKey from a 64-byte KeyMaterial. Seed SecurityStrength must match algorithm security strength: 128-bit (ML-KEM-512), 192-bit (ML-KEM-768), or 256-bit (ML-KEM-1024).
Trait Implementations§
Source§impl<const k: usize, const eta1: i16, const LAMBDA: i16, const SK_LEN: usize, const FULL_SK_LEN: usize, const PK_LEN: usize, const T_PACKED_LEN: usize> Clone for MLKEMSeedPrivateKey<k, eta1, LAMBDA, SK_LEN, FULL_SK_LEN, PK_LEN, T_PACKED_LEN>
impl<const k: usize, const eta1: i16, const LAMBDA: i16, const SK_LEN: usize, const FULL_SK_LEN: usize, const PK_LEN: usize, const T_PACKED_LEN: usize> Clone for MLKEMSeedPrivateKey<k, eta1, LAMBDA, SK_LEN, FULL_SK_LEN, PK_LEN, T_PACKED_LEN>
Source§fn clone(
&self,
) -> MLKEMSeedPrivateKey<k, eta1, LAMBDA, SK_LEN, FULL_SK_LEN, PK_LEN, T_PACKED_LEN>
fn clone( &self, ) -> MLKEMSeedPrivateKey<k, eta1, LAMBDA, SK_LEN, FULL_SK_LEN, PK_LEN, T_PACKED_LEN>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<const k: usize, const eta1: i16, const LAMBDA: i16, const SK_LEN: usize, const FULL_SK_LEN: usize, const PK_LEN: usize, const T_PACKED_LEN: usize> Debug for MLKEMSeedPrivateKey<k, eta1, LAMBDA, SK_LEN, FULL_SK_LEN, PK_LEN, T_PACKED_LEN>
Debug impl mainly to prevent the secret key from being printed in logs.
impl<const k: usize, const eta1: i16, const LAMBDA: i16, const SK_LEN: usize, const FULL_SK_LEN: usize, const PK_LEN: usize, const T_PACKED_LEN: usize> Debug for MLKEMSeedPrivateKey<k, eta1, LAMBDA, SK_LEN, FULL_SK_LEN, PK_LEN, T_PACKED_LEN>
Debug impl mainly to prevent the secret key from being printed in logs.
Source§impl<const k: usize, const eta1: i16, const LAMBDA: i16, const SK_LEN: usize, const FULL_SK_LEN: usize, const PK_LEN: usize, const T_PACKED_LEN: usize> Display for MLKEMSeedPrivateKey<k, eta1, LAMBDA, SK_LEN, FULL_SK_LEN, PK_LEN, T_PACKED_LEN>
Display impl mainly to prevent the secret key from being printed in logs.
impl<const k: usize, const eta1: i16, const LAMBDA: i16, const SK_LEN: usize, const FULL_SK_LEN: usize, const PK_LEN: usize, const T_PACKED_LEN: usize> Display for MLKEMSeedPrivateKey<k, eta1, LAMBDA, SK_LEN, FULL_SK_LEN, PK_LEN, T_PACKED_LEN>
Display impl mainly to prevent the secret key from being printed in logs.
Source§impl<const k: usize, const eta1: i16, const LAMBDA: i16, const SK_LEN: usize, const FULL_SK_LEN: usize, const PK_LEN: usize, const T_PACKED_LEN: usize> Drop for MLKEMSeedPrivateKey<k, eta1, LAMBDA, SK_LEN, FULL_SK_LEN, PK_LEN, T_PACKED_LEN>
Zeroizing drop
impl<const k: usize, const eta1: i16, const LAMBDA: i16, const SK_LEN: usize, const FULL_SK_LEN: usize, const PK_LEN: usize, const T_PACKED_LEN: usize> Drop for MLKEMSeedPrivateKey<k, eta1, LAMBDA, SK_LEN, FULL_SK_LEN, PK_LEN, T_PACKED_LEN>
Zeroizing drop
impl<const k: usize, const eta1: i16, const LAMBDA: i16, const SK_LEN: usize, const FULL_SK_LEN: usize, const PK_LEN: usize, const T_PACKED_LEN: usize> Eq for MLKEMSeedPrivateKey<k, eta1, LAMBDA, SK_LEN, FULL_SK_LEN, PK_LEN, T_PACKED_LEN>
Source§impl<const k: usize, const eta1: i16, const LAMBDA: i16, const SK_LEN: usize, const FULL_SK_LEN: usize, const PK_LEN: usize, const T_PACKED_LEN: usize> KEMPrivateKey<SK_LEN> for MLKEMSeedPrivateKey<k, eta1, LAMBDA, SK_LEN, FULL_SK_LEN, PK_LEN, T_PACKED_LEN>
impl<const k: usize, const eta1: i16, const LAMBDA: i16, const SK_LEN: usize, const FULL_SK_LEN: usize, const PK_LEN: usize, const T_PACKED_LEN: usize> KEMPrivateKey<SK_LEN> for MLKEMSeedPrivateKey<k, eta1, LAMBDA, SK_LEN, FULL_SK_LEN, PK_LEN, T_PACKED_LEN>
Source§impl<const k: usize, const eta1: i16, const LAMBDA: i16, const SK_LEN: usize, const FULL_SK_LEN: usize, const PK_LEN: usize, const T_PACKED_LEN: usize> MLKEMPrivateKeyTrait<k, SK_LEN, FULL_SK_LEN, PK_LEN, T_PACKED_LEN> for MLKEMSeedPrivateKey<k, eta1, LAMBDA, SK_LEN, FULL_SK_LEN, PK_LEN, T_PACKED_LEN>
impl<const k: usize, const eta1: i16, const LAMBDA: i16, const SK_LEN: usize, const FULL_SK_LEN: usize, const PK_LEN: usize, const T_PACKED_LEN: usize> MLKEMPrivateKeyTrait<k, SK_LEN, FULL_SK_LEN, PK_LEN, T_PACKED_LEN> for MLKEMSeedPrivateKey<k, eta1, LAMBDA, SK_LEN, FULL_SK_LEN, PK_LEN, T_PACKED_LEN>
Source§fn encode_full_sk(&self) -> [u8; FULL_SK_LEN]
fn encode_full_sk(&self) -> [u8; FULL_SK_LEN]
This produces the full private key in the encoding specified in FIPS 203 so that it is compatible with other implementations.
Note that since this encoding does not include the seed, this is a one-way operation; after exporting in this encoding, it will be impossible to re-import it into a MLKEMSeedPrivateKey.
As described on Algorithm 16 line 3: dk ← (dkPKE ‖ ek ‖ H(ek) ‖ 𝑧)
Source§fn full_sk_encode_out(&self, out: &mut [u8; FULL_SK_LEN]) -> usize
fn full_sk_encode_out(&self, out: &mut [u8; FULL_SK_LEN]) -> usize
This produces the full private key in the encoding specified in the FIPS so that it is compatible with other implementations. Note that this encoding does not include the seed, so if exporting in this encoding, it will be impossible to re-import it into this implementation.
As described on Algorithm 16 line 3: dk ← (dkPKE ‖ ek ‖ H(ek) ‖ 𝑧)