Created
December 10, 2017 17:42
-
-
Save mikepatrick/42c6276fead2c02175a6bc1587ed29dd to your computer and use it in GitHub Desktop.
sig4 - http://docs.aws.amazon.com/general/latest/gr/signature-v4-examples.html#signature-v4-examples-python
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import hmac, hashlib | |
#http://docs.aws.amazon.com/general/latest/gr/signature-v4-examples.html#signature-v4-examples-python | |
DateKey = hmac.new(b'AWS4wJalrXUtnFEMI/K7MDENG+bPxRfiCYEXAMPLEKEY', b'20120215', hashlib.sha256).digest() | |
print("kdate: " + hmac.new(b'AWS4wJalrXUtnFEMI/K7MDENG+bPxRfiCYEXAMPLEKEY', b'20120215', hashlib.sha256).hexdigest()) | |
DateRegionKey = hmac.new(DateKey, b'us-east-1', hashlib.sha256).digest() | |
print("kRegion: " + hmac.new(DateKey, b'us-east-1', hashlib.sha256).hexdigest()) | |
DateRegionServiceKey = hmac.new(DateRegionKey, b'iam', hashlib.sha256).digest() | |
print('kService: ' + hmac.new(DateRegionKey, b'iam', hashlib.sha256).hexdigest()) | |
SigningKey = hmac.new(DateRegionServiceKey, b'aws4_request', hashlib.sha256).digest() | |
print('kSigning: ' + hmac.new(DateRegionServiceKey, b'aws4_request', hashlib.sha256).hexdigest()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment