Google Answers Logo
View Question
 
Q: HMAC SHA-1 Trouble. ( No Answer,   3 Comments )
Question  
Subject: HMAC SHA-1 Trouble.
Category: Computers > Programming
Asked by: slow55-ga
List Price: $10.00
Posted: 19 Dec 2005 21:21 PST
Expires: 20 Dec 2005 22:01 PST
Question ID: 607785
I'm writing a program for Amazon's Mechanical Turk, and i'm having a
lot of trouble with HMAC SHA-1.  Let me explain.

The string i'm encoding is
"AWSMechanicalTurkRequesterCreateHIT2005-12-20T03:14:04.000Z"

with "HR/yxxPq6ntBy4j0/aqcVRrVsd3WNSi3ldj7+C2W" as my secret key
I get "f8854f5ffb05895ab6d1bafc35f7213c2349aa87"

and to base64, I get "Zjg4NTRmNWZmYjA1ODk1YWI2ZDFiYWZjMzVmNzIxM2MyMzQ5YWE4Nw=="

Which is way longer than the sig should be (according to your scratchpad)
(scratchpad found here http://awszone.techies.net/index.aws)

If you use my key 179R1739QQHMJV5KG202 and the secret key I gave you
up there, you could use those at the autosign requests thing and save
em', go to create hit, and click "show me" it'll show what the sig
SHOULD be.  Could you figure out what i'm doing wrong?  Thanks a lot.
Answer  
There is no answer at this time.

Comments  
Subject: Re: HMAC SHA-1 Trouble.
From: bozo99-ga on 20 Dec 2005 09:15 PST
 
How do you cope with the test vectors of RFC2104 ?


  key =         0x0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b
  key_len =     16 bytes
  data =        "Hi There"
  data_len =    8  bytes
  digest =      0x9294727a3638bb1c13f48ef8158bfc9d

  key =         "Jefe"
  data =        "what do ya want for nothing?"
  data_len =    28 bytes
  digest =      0x750c783e6ab0b503eaa86e310a5db738

  key =         0xAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
  key_len       16 bytes
  data =        0xDDDDDDDDDDDDDDDDDDDD...
                ..DDDDDDDDDDDDDDDDDDDD...
                ..DDDDDDDDDDDDDDDDDDDD...
                ..DDDDDDDDDDDDDDDDDDDD...
                ..DDDDDDDDDDDDDDDDDDDD
  data_len =    50 bytes
  digest =      0x56be34521d144c88dbb8c733f0e8b3f6
Subject: Re: HMAC SHA-1 Trouble.
From: bozo99-ga on 20 Dec 2005 17:11 PST
 
Those are MD5 test vectors I should point out - but once you've got that
working switching hash functions is simple.
Subject: Re: HMAC SHA-1 Trouble.
From: slow55-ga on 20 Dec 2005 17:34 PST
 
yeah, my SHA-1 tests come out ok, I THINK my problem is with my base64 encoding.

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy