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.
I think you have multiple problems. First of all, you're prepending your key string with "AWS" instead of "AWS4". Second, if I search for 969fbb94feb542b71ede6f87fe4d5fa29c789342b0f407474670f0c2489e0a0d I find this example from AWS that shows that result from a different key and date string. This online calculator verifies the result for these values: