Created
May 19, 2011 01:46
-
-
Save rsbohn/980000 to your computer and use it in GitHub Desktop.
test hmac-sha1
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
ruleset a421x67 { | |
meta { | |
name "test-hmac-sha1" | |
description "Test hmac_sha1_base64(msg, key) function" | |
author "Randall Bohn" | |
logging on | |
} | |
dispatch {} | |
global {} | |
rule hmac_test { | |
select when pageview ".*" | |
pre { | |
msg = "GET\n\n\nWed, 28 Mar 2007 01:29:59 +0000\n/"; | |
stkey = "uV3F3YluFJax1cknvbcGwgjvx4QpvB+leU8dUj2o"; | |
expected = "Db+gepJSUbZKwpx1FR0DLtEYoZA="; | |
actual = math:hmac_sha1_base64(msg, stkey); | |
} | |
{ | |
append("#main", "<div>Example from <a href='http://docs.amazonwebservices.com/AmazonS3/latest/dev/RESTAuthentication.html'>AWS Docs</a></div>"); | |
append("#main", "<div>expected: "+expected+"</div>"); | |
append("#main", "<div>got: "+actual+"</div>"); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Run this ruleset: http://ktest.heroku.com/a421x67