Skip to main content

MLKEMPrivateKeyTrait

Trait MLKEMPrivateKeyTrait 

Source
pub trait MLKEMPrivateKeyTrait<const k: usize, PK: MLKEMPublicKeyInternalTrait<k, PK_LEN>, const SK_LEN: usize, const PK_LEN: usize>: KEMPrivateKey<SK_LEN> {
    // Required methods
    fn seed(&self) -> Option<KeyMaterial<64>>;
    fn pk(&self) -> &PK;
    fn pk_hash(&self) -> &[u8; 32];
    fn sk_decode(sk: &[u8; SK_LEN]) -> Result<Self, KEMError>;
}
Expand description

General trait for all ML-KEM private keys types.

Required Methods§

Source

fn seed(&self) -> Option<KeyMaterial<64>>

Get a ref to the seed, if there is one stored with this private key

Source

fn pk(&self) -> &PK

This is a partial implementation of keygen_internal(), and probably not allowed in FIPS mode.

Source

fn pk_hash(&self) -> &[u8; 32]

Get a ref to the stored public key hash.

Source

fn sk_decode(sk: &[u8; SK_LEN]) -> Result<Self, KEMError>

Decode the private key.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<const k: usize, PK: MLKEMPublicKeyInternalTrait<k, PK_LEN>, SK: MLKEMPrivateKeyTrait<k, PK, SK_LEN, PK_LEN> + MLKEMPrivateKeyInternalTrait<k, PK, SK_LEN, PK_LEN>, const SK_LEN: usize, const PK_LEN: usize> MLKEMPrivateKeyTrait<k, PK, SK_LEN, PK_LEN> for MLKEMPrivateKeyExpanded<k, PK, SK, SK_LEN, PK_LEN>

Source§

impl<const k: usize, PK: MLKEMPublicKeyInternalTrait<k, PK_LEN>, const SK_LEN: usize, const PK_LEN: usize> MLKEMPrivateKeyTrait<k, PK, SK_LEN, PK_LEN> for MLKEMPrivateKey<k, PK, SK_LEN, PK_LEN>