Skip to main content

MLDSAPublicKeyTrait

Trait MLDSAPublicKeyTrait 

Source
pub trait MLDSAPublicKeyTrait<const k: usize, const T1_PACKED_LEN: usize, const PK_LEN: usize>: SignaturePublicKey<PK_LEN> {
    // Required methods
    fn pk_decode(pk: &[u8; PK_LEN]) -> Self;
    fn compute_tr(&self) -> [u8; 64];
}
Expand description

General trait for all ML-DSA public keys types.

Required MethodsΒ§

Source

fn pk_decode(pk: &[u8; PK_LEN]) -> Self

Algorithm 23 pkDecode(π‘π‘˜) Reverses the procedure pkEncode. Input: Public key π‘π‘˜ ∈ 𝔹32+32π‘˜(bitlen (π‘žβˆ’1)βˆ’π‘‘). Output: 𝜌 ∈ 𝔹32, 𝐭1 ∈ π‘…π‘˜ with coefficients in [0, 2bitlen (π‘žβˆ’1)βˆ’π‘‘ βˆ’ 1].

Source

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

Compute the public key hash (tr) from the public key.

This is exposed as a public API for a few reasons:

  1. tr is required for some external-prehashing schemes such as the so-called β€œexternal mu” signing mode.
  2. tr is the canonical fingerprint of an ML-DSA public key, so would be an appropriate value to use, for example, to build a public key lookup or deny-listing table.

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, const T1_PACKED_LEN: usize, const PK_LEN: usize> MLDSAPublicKeyTrait<k, T1_PACKED_LEN, PK_LEN> for MLDSAPublicKey<k, T1_PACKED_LEN, PK_LEN>