pub trait MLDSAPublicKeyTrait<const k: usize, const PK_LEN: usize>: SignaturePublicKey {
// Required methods
fn pk_encode(&self) -> [u8; PK_LEN];
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Β§
Sourcefn pk_encode(&self) -> [u8; PK_LEN]
fn pk_encode(&self) -> [u8; PK_LEN]
Algorithm 22 pkEncode(π, π1) Encodes a public key for ML-DSA into a byte string. Input:π β πΉ32, π1 β π π with coefficients in [0, 2bitlen (πβ1)βπ β 1]. Output: Public key ππ β πΉ32+32π(bitlen (πβ1)βπ).
Sourcefn pk_decode(pk: &[u8; PK_LEN]) -> Self
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].
Sourcefn compute_tr(&self) -> [u8; 64]
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:
tris required for some external-prehashing schemes such as the so-called βexternal muβ signing mode.tris 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", so this trait is not object safe.