HMAC-SHA256("AWS4" + "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY","20130524")
and the result, in HEX format should be:
969fbb94feb542b71ede6f87fe4d5fa29c789342b0f407474670f0c2489e0a0d
I'm using the following code (to no avail):
Code: Select all
HMAC = createobject("roHMAC")
ba = createobject("roByteArray")
ba.FromAsciiString("AWS" + "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY") 'this is the "key" that AWS uses in the example
if HMAC.Setup("sha256", ba) = 0 'this if group of code is based on the example code in Rokus documentation
message1 = CreateObject("roByteArray")
message2 = CreateObject("roByteArray")
messageStr1 = "AWS4" + "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY"
message1.fromAsciiString(messageStr1)
HMAC.Update(message1)
message2.FromAsciiString("20130524")
HMAC.Update(message2)
DateKey = HMAC.final()
? DateKey.ToHexString()
I'm getting this result:
8AE94D64B5C24455E4C0508F2AD8AA036BAE46B6469DCE6599F035B2AFFD11CB
Can anyone point me in the right direction? I've tried running the code with only message2, (wondering if the "setup" command might be seeding the function with the key?) but that doesn't work either.
Help?!
Thanks