Skip to main content

AWS signature verification routines

Project description

This library provides signature verification for requests made to an AWS service. Typically, this is used to provide mock interfaces for AWS services or to rewrite AWS requests through a proxy host.

The current source tree can be found on GitHub.

Documentation is available at docs.ionosphere.io.

Currently only SigV4 and SigV4S3 (the S3 variant of SigV4) are supported.

Example Usage

>>> import awssig
>>> access_key = "AKIDEXAMPLE"
>>> secret_key = "wJalrXUtnFEMI/K7MDENG+bPxRfiCYEXAMPLEKEY"
>>> key_mapping = { access_key: secret_key }
>>> v = awssig.AWSSigV4Verifier(
...     request_method="GET",
...     uri_path="/",
...     query_string="a=foo&b=foo",
...     headers={
...         "date": "Mon, 09 Sep 2011 23:36:00 GMT",
...         "host": "host.foo.com",
...         "authorization": (
...             "AWS4-HMAC-SHA256 "
...             "Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, "
...             "SignedHeaders=date;host, "
...             "Signature=0dc122f3b28b831ab48ba65cb47300de53fbe91b577fe113edac383730254a3b"),
...    },
...    body=b"",
...    region="us-east-1",
...    service="host",
...    key_mapping=key_mapping,
...    timestamp_mismatch=None)
>>> try:
...     v.verify()
...     print("ok")
... except awssig.InvalidSignatureError as e:
...     print("error: %s" % e)
ok
>>> v = awssig.AWSSigV4S3Verifier(
...     request_method="POST",
...     uri_path="/a//b/../c",
...     headers={
...         "date": "Mon, 09 Sep 2011 23:36:00 GMT",
...         "host": "host.foo.com",
...         "authorization": (
...             "AWS4-HMAC-SHA256 "
...             "Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, "
...             "SignedHeaders=date;host, "
...             "Signature=6b8af5a1e94a59c511e47267ab0cbfa1783dc42861ab7f09e0dba62680da8b28"),
...         "x-amz-content-sha256": "UNSIGNED-PAYLOAD",
...    },
...    body=b"Hello world",
...    region="us-east-1",
...    service="host",
...    key_mapping=key_mapping,
...    timestamp_mismatch=None)
>>> try:
...     v.verify()
...     print("ok")
... except awssig.InvalidSignatureError as e:
...     print("error: %s" % e)
ok

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

awssig-0.4.0.tar.gz (13.0 kB view details)

Uploaded Source

File details

Details for the file awssig-0.4.0.tar.gz.

File metadata

  • Download URL: awssig-0.4.0.tar.gz
  • Upload date:
  • Size: 13.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.38.0 CPython/3.7.5

File hashes

Hashes for awssig-0.4.0.tar.gz
Algorithm Hash digest
SHA256 09d855b4140eb18663fd5131e8913516fb7b720650c2409a3dfafc4c4a6e40cc
MD5 f4d8c837c166f86f11aefb8193a748a8
BLAKE2b-256 3f31531d4e8fc882c80e3fa2d3bc455d3a63364fef8b5647aea07e0c8a799a38

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page