Browse Community
Help
Log In
Responses(3)
Solutions(1)
rbala1
222 Posts
0
January 5th, 2011 07:00
Hey there,
The newline character for the last header needed to be removed. The following code generates the expected hash:
$key = "LJLuryj6zs8ste6Y3jTGQp71xq0=";
$test_headers = "POST\n";$test_headers .= "application/octet-stream\n";$test_headers .= "\n";$test_headers .= "Thu, 05 Jun 2008 16:38:19 GMT\n";$test_headers .= "/rest/objects\n";$test_headers .= "x-emc-date:Thu, 05 Jun 2008 16:38:19 GMT\n";$test_headers .= "x-emc-groupacl:other=NONE\n";$test_headers .= "x-emc-listable-meta:part4/part7/part8=quick\n";$test_headers .= "x-emc-meta:part1=buy\n";$test_headers .= "x-emc-uid:6039ac182f194e15b9261d73ce044939/user1\n";$test_headers .= "x-emc-useracl:john=FULL_CONTROL,mary=WRITE";
$hash = hash_init("sha1", HASH_HMAC, base64_decode($key));
hash_update($hash, $test_headers);
echo "Hash: " . base64_encode(hash_final($hash, true)) . "\n";
?>
Raj
ripburn
2 Posts
January 5th, 2011 08:00
That was such a small oversight. Thank you.
January 5th, 2011 17:00
No problem. Let us know if you need any other help.
Out of curiosity, why didn't the existing PHP wrapper work for you?
Dell Support Resources
View All
Top
rbala1
222 Posts
0
January 5th, 2011 07:00
Hey there,
The newline character for the last header needed to be removed. The following code generates the expected hash:
$key = "LJLuryj6zs8ste6Y3jTGQp71xq0=";
$test_headers = "POST\n";
$test_headers .= "application/octet-stream\n";
$test_headers .= "\n";
$test_headers .= "Thu, 05 Jun 2008 16:38:19 GMT\n";
$test_headers .= "/rest/objects\n";
$test_headers .= "x-emc-date:Thu, 05 Jun 2008 16:38:19 GMT\n";
$test_headers .= "x-emc-groupacl:other=NONE\n";
$test_headers .= "x-emc-listable-meta:part4/part7/part8=quick\n";
$test_headers .= "x-emc-meta:part1=buy\n";
$test_headers .= "x-emc-uid:6039ac182f194e15b9261d73ce044939/user1\n";
$test_headers .= "x-emc-useracl:john=FULL_CONTROL,mary=WRITE";
$hash = hash_init("sha1", HASH_HMAC, base64_decode($key));
hash_update($hash, $test_headers);
echo "Hash: " . base64_encode(hash_final($hash, true)) . "\n";
?>
Raj
ripburn
2 Posts
0
January 5th, 2011 08:00
That was such a small oversight. Thank you.
rbala1
222 Posts
0
January 5th, 2011 17:00
No problem. Let us know if you need any other help.
Out of curiosity, why didn't the existing PHP wrapper work for you?