Permalink
Browse files

using crypto lib from http://code.google.com/p/crypto-js/ for sha1 hmac

  • Loading branch information...
sajal committed Jan 19, 2012
1 parent a9a0c94 commit 8e2102fd58fdafac3517c57fbac8e7b74f320ff5
Showing with 18 additions and 4 deletions.
  1. +13 −0 2.5.3-crypto-sha1-hmac.js
  2. +3 −2 cloudfrontapi.js
  3. +2 −2 popup.html
View

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
View
@@ -48,8 +48,9 @@ var cloudfrontapi = function(aws_access, aws_secret){
this.getAuth = function(){
var datestr = this.getDate();
- var signature = sha1.hmac.toB64(this.aws_secret, datestr);
- var authorization = "AWS " + this.aws_access + ":" + signature + "="; // no idea why i gotta manually add = but this shit works
+ //var signature = sha1.hmac.toB64(this.aws_secret, datestr);
+ var signature = Crypto.util.bytesToBase64(Crypto.HMAC(Crypto.SHA1, datestr, this.aws_secret, { asBytes: true }));
+ var authorization = "AWS " + this.aws_access + ":" + signature;
return {datestr: datestr, authorization:authorization}
};
View
@@ -5,11 +5,11 @@
<link rel="stylesheet" href="style.css" type="text/css" media="screen" />
<script src="js/jquery-1.7.1.min.js" type="text/javascript"></script>
<script src="js/jquery-ui-1.8.17.custom.min.js" type="text/javascript"></script>
- <script src="sha1.js"></script>
+ <script type="text/javascript" src="2.5.3-crypto-sha1-hmac.js"></script>
<script src="xml2json.js"></script>
<script src="cloudfrontapi.js"></script>
<script src="script.js"></script>
-
+
</head>
<body>

0 comments on commit 8e2102f

Please sign in to comment.