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 beP::PK_LENbytes).msg: the signed message.ctx: the context string used at signing time (at most 255 bytes).sig: the signature (must beP::SIG_LENbytes).
Returns Ok(true) if the signature is valid, Ok(false) otherwise.
ยงErrors
MlDsaError::ContextTooLongifctxexceeds 255 bytes.MlDsaError::InvalidPublicKeyifpkhas the wrong length.MlDsaError::InvalidSignatureifsighas the wrong length.