Skip to main content

Module sigv4

Module sigv4 

Source
Expand description

AWS Signature Version 4, the subset Route53 needs: no unsigned payload, and headers limited to host, x-amz-date and (when present) x-amz-security-token.

See https://docs.aws.amazon.com/IAM/latest/UserGuide/create-signed-request.html for the algorithm this implements. Each step is a function of its own, and the tests check each against AWS’s published answers.

StructsΒ§

Request πŸ”’
The request sign signs.
Scope πŸ”’
The region and service a signature is scoped to.
Signed πŸ”’

ConstantsΒ§

ROUTE53 πŸ”’
Route53 is a global service; every request is signed against this fixed region regardless of where the caller runs.

FunctionsΒ§

canonical_query πŸ”’
canonical_request πŸ”’
The canonical request. headers are the headers the signature covers, each name in lower case, in any order.
encode_path πŸ”’
hex_sha256 πŸ”’
hmac_bytes πŸ”’
host_header πŸ”’
sign πŸ”’
Signs request over the headers HttpTransport sends with it: host, x-amz-date and, for a temporary credential, x-amz-security-token.
signature πŸ”’
The signature: an HMAC of the string to sign, under a key derived from the secret, the date and the scope.
signed_headers πŸ”’
The SignedHeaders list: every name in headers, sorted.
string_to_sign πŸ”’
The string to sign: the algorithm, the moment, the credential scope and the canonical request’s hash.
uri_encode πŸ”’
AWS’s URI-encoding rules: unreserved characters pass through unescaped, / is left alone in a path, everything else becomes uppercase-hex %XX.