Created
December 10, 2017 17:44
-
-
Save mikepatrick/fca1e977501827a76ef7d5bf5242bf05 to your computer and use it in GitHub Desktop.
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//sigv4-calculate-signature.html | |
DateKey = hmac.new(b'AWS4wJalrXUtnFEMI/K7MDENG+bPxRfiCYEXAMPLEKEY', b'20150830', hashlib.sha256).digest() | |
print("kdate: " + hmac.new(b'AWS4wJalrXUtnFEMI/K7MDENG+bPxRfiCYEXAMPLEKEY', b'20150830', 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()) | |
string_to_sign = '''AWS4-HMAC-SHA256 | |
20150830T123600Z | |
20150830/us-east-1/iam/aws4_request | |
f536975d06c0309214f805bb90ccff089219ecd68b2577efef23edd43b7e1a59''' | |
signature = hmac.new(SigningKey, string_to_sign, hashlib.sha256).hexdigest() | |
print('signature: ' + signature) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
hey i dont know code but need this added to my javascript can anyone help me im willing to pay contact me ontime24seven@gmail.com