Expand description
AWS Signature Version 4 verification.
This module implements the core SigV4 signature verification flow:
- Parse the
Authorizationheader to extract the algorithm, credential scope, signed headers, and provided signature. - Reconstruct the canonical request from the HTTP request parts.
- Build the string to sign from the timestamp, credential scope, and canonical request hash.
- Derive the signing key using HMAC-SHA256 from the secret key and credential scope components.
- Compute the expected signature and compare it to the provided signature using constant-time comparison.
The main entry point is verify_sigv4.
Structs§
- Auth
Result - The result of a successful SigV4 verification.
- Parsed
Auth - Parsed components of an AWS SigV4
Authorizationheader.
Functions§
- build_
string_ to_ sign - Build the SigV4 string to sign.
- compute_
signature - Compute the HMAC-SHA256 signature of
datausing the givensigning_key. - derive_
signing_ key - Derive the SigV4 signing key using HMAC-SHA256 chain.
- hash_
payload - Compute the SHA-256 hash of the given payload and return it as a hex string.
- parse_
authorization_ header - Parse an AWS SigV4
Authorizationheader value into its components. - verify_
sigv4 - Verify an AWS SigV4-signed HTTP request.