Skip to main content

verify

Function verify 

Source
pub fn verify<P: Params>(
    pk: &[u8],
    msg: &[u8],
    ctx: &[u8],
    sig: &[u8],
) -> Result<bool, MlDsaError>
Expand description

Verify a signature on a message with an optional context string.

Implements Algorithm 3 of FIPS 204 (ML-DSA.Verify). Constructs the pre-formatted message M' = 0x00 || len(ctx) || ctx || msg and delegates to verify_internal.

  • pk: public key (must be P::PK_LEN bytes).
  • msg: the signed message.
  • ctx: the context string used at signing time (at most 255 bytes).
  • sig: the signature (must be P::SIG_LEN bytes).

Returns Ok(true) if the signature is valid, Ok(false) otherwise.

ยงErrors