I am following this example
http://docs.aws.amazon.com/AmazonS3/latest/API/sigv4-query-string-auth.html
and trying to reproduce the 64 character string for the
I can't tell from your post but those are quite possibly exactly the same results, formatted differently.
Your code returns the raw result of the HMAC operation - this is arbitrary binary data so it's not going to print as anything readable. Amazon expect you to provide the hex representation for each byte: your first couple of bytes are "\xae\xee" instead of "aeee"
The easiest way to do this is call hexdigest
rather than digest
. Note that you should only do this for the final HMAC (when you sign the string to sign with the signing key) not when constructing the signing key
It's possible that your "strange sequence of characters" is in fact the correct output.
OpenSSL::HMAC.digest
spits out a value represented in binary, and you are comparing that to a value represented in hex
Check to see what happens when you print out the signature after converting it to hex representation like so:
signature.each_byte.map { |b| "%02x" % b }.join