Last active
December 22, 2015 03:09
-
-
Save jpillora/6408033 to your computer and use it in GitHub Desktop.
S3 Request Signing (generates Authorization headers)
This file contains hidden or 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
//Performs the signing in the first example of: | |
// http://docs.aws.amazon.com/AmazonS3/latest/dev/RESTAuthentication.html | |
//Requires: | |
// http://www.defensivejs.com/djcl/encoding.js | |
// http://www.defensivejs.com/djcl/hashing.js | |
var str = "GET\n"+ | |
"\n"+ | |
"\n"+ | |
"Tue, 27 Mar 2007 19:36:42 +0000\n"+ | |
"/johnsmith/photos/puppy.jpg"; | |
var k = "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY"; | |
hashing.hmac_hash = hashing.sha1; | |
var result = encoding.base64_encode(encoding.hstr2astr(hashing.HMAC(k,str))); | |
print(result); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment