Skip to main content

verify_response

Function verify_response 

Source
pub fn verify_response(
    status: u16,
    signature_input: &str,
    signature: &str,
    headers: &[(&str, &str)],
    key: &VerifyingKey<'_>,
) -> Result<(), Error>
Expand description

Verify an RFC 9421 signature on a response, given its status, the Signature-Input and Signature field values, and its header fields.

The derived component a response can be rebuilt from is @status; a covered header field, content-digest among them, is taken from headers as verify_request takes one. Whether Content-Digest describes the body, and whether the signature has expired (expires_at) or is too old (created_at), are the caller’s to check: the policy is the protocol’s.

§Errors

When the signature cannot be read, covers what cannot be rebuilt or was not sent, states an algorithm the key is not, or does not verify.