Skip to main content

MLDSAPrivateKeyTrait

Trait MLDSAPrivateKeyTrait 

Source
pub trait MLDSAPrivateKeyTrait<const k: usize, const l: usize, const eta: usize, const SK_LEN: usize, const PK_LEN: usize>: SignaturePrivateKey<SK_LEN> {
    // Required methods
    fn seed(&self) -> Option<&KeyMaterial<32>>;
    fn tr(&self) -> &[u8; 64];
    fn A_hat(&self) -> Matrix<k, l>;
    fn derive_pk(&self) -> MLDSAPublicKey<k, l, PK_LEN>;
    fn sk_decode(sk: &[u8; SK_LEN]) -> Result<Self, SignatureError>;
}
Expand description

General trait for all ML-DSA private keys types.

Required MethodsΒ§

Source

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

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

Source

fn tr(&self) -> &[u8; 64]

Get a ref to the key hash tr.

Source

fn A_hat(&self) -> Matrix<k, l>

Get the public matrix A_hat.

Source

fn derive_pk(&self) -> MLDSAPublicKey<k, l, PK_LEN>

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

Source

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

Algorithm 25 skDecode(π‘ π‘˜) Reverses the procedure skEncode. Input: Private key π‘ π‘˜ ∈ 𝔹32+32+64+32β‹…((β„“+π‘˜)β‹…bitlen (2πœ‚)+π‘‘π‘˜). Output: 𝜌 ∈ 𝔹32, 𝐾 ∈ 𝔹32, π‘‘π‘Ÿ ∈ 𝔹64 , 𝐬1 ∈ 𝑅ℓ, 𝐬2 ∈ π‘…π‘˜, 𝐭0 ∈ π‘…π‘˜ with coefficients in [βˆ’2π‘‘βˆ’1 + 1, 2π‘‘βˆ’1].

Note: this object contains only the simple decoding routine to unpack a semi-expanded key. See MLDSATrait for key generation functions, including derive-from-seed and consistency-check functions.

Dyn CompatibilityΒ§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

ImplementorsΒ§

SourceΒ§

impl<const k: usize, const l: usize, const eta: usize, PK: MLDSAPublicKeyInternalTrait<k, PK_LEN>, SK: MLDSAPrivateKeyTrait<k, l, eta, SK_LEN, PK_LEN> + MLDSAPrivateKeyInternalTrait<k, l, eta, SK_LEN, PK_LEN>, const SK_LEN: usize, const PK_LEN: usize> MLDSAPrivateKeyTrait<k, l, eta, SK_LEN, PK_LEN> for MLDSAPrivateKeyExpanded<k, l, eta, PK, SK, SK_LEN, PK_LEN>

SourceΒ§

impl<const k: usize, const l: usize, const eta: usize, const SK_LEN: usize, const PK_LEN: usize> MLDSAPrivateKeyTrait<k, l, eta, SK_LEN, PK_LEN> for MLDSAPrivateKey<k, l, eta, SK_LEN, PK_LEN>