Trait jws::Verifier

source ·
pub trait Verifier {
    fn verify(
        &mut self,
        headers: HeadersRef<'_>,
        encoded_header: &[u8],
        encoded_payload: &[u8],
        signature: &[u8]
    ) -> Result<()>; }
Expand description

A verifier for JWS messages.

Required Methods

Verify the signature of a JWS message.

This function needs access to the decoded message headers in order to determine which MAC algorithm to use. It also needs access to the raw encoded parts to verify the MAC.

If the signature is invalid, the function should return a [error::InvalidSignature] error. It may also report any of the other supported error variants.

Args:
  • headers: The available message headers: the protected and/or unpprotected header.
  • encoded_header: The raw encoded protected header, needed to compute the MAC. If there is no protected header, this is an empty slice.
  • encoded_payload: The raw encoded payload, needed to compute the MAC.
  • signature: The signature associated with the message, should be tested against the computed MAC.

Implementors