Skip to main content

verify_challenge

Function verify_challenge 

Source
pub fn verify_challenge(
    vk: &VerifyingKey,
    pol: &Policy,
    context: &str,
    challenge: &[u8],
    sig: &Signature,
) -> bool
Expand description

Verifies a challenge signature against the identity derived from pol.

Returns false for a signature that does not verify, and for a policy no identity can be derived from.

The identity comes from Policy::derive_ibs, which canonicalizes attribute values. So this answers “does the signer hold the key for the identity this policy derives to”, not “does the signer’s policy read exactly like this one”: a policy spelling an e-mail address Alice@Example.COM verifies against a key issued for alice@example.com. A caller that keys on the raw attribute value has to canonicalize it itself; the proof does not pin spelling.

§Arguments

  • vk - The IBS verifying key (master public key).
  • pol - The policy whose identity the signer is expected to hold a key for.
  • context - The same context the signature was requested under.
  • challenge - The bytes this verifier chose.
  • sig - The signature to check.