Highlighted

Creating HMAC Hash

Engaged ,
Jul 07, 2015

Copy link to clipboard

Copied

After a couple fruitless hours of trying I need some help...  I'm trying to sign a URL for a REST API and, for the life of me, can't get CF to output the expected result.  The API is Aspose and the the instructions are here:

http://www.aspose.com/docs/display/totalcloud/Request+Format

According to their example I need to hash this URL: http://api.aspose.com/1.1/storage/folder/test_folder?appSID=c821f123-1a8b-4b97-925a-9d69a6b2fcd8

Using this Key: 23e9d89a967a5f18142221fa8f7cbcd0

And the result should be:Z98TBrlwdtx3pTa6fWVD/Q0c2dE=

According to the C# example they give the algorithm should be: HMACSHA1 and the encoding: UTF8

I cannot get CF to produce this result.

I've tried using the CF function hmac().

#toBase64(hmac(url,key,"HMACSHA1","UTF8"))# gives me: MjYwMkQxN0EyM0IyMzkxNjNDMDU4QTQyMjc3RDgyNkMyNzM0NTA3OA==

I've also tried suggestions and variations found here:

http://stackoverflow.com/questions/9186773/coldfusion-hmac-sha1-encryption

and Ban Nadel's Crypto.cfc.

What am I missing here?

Views

192

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

Creating HMAC Hash

Engaged ,
Jul 07, 2015

Copy link to clipboard

Copied

After a couple fruitless hours of trying I need some help...  I'm trying to sign a URL for a REST API and, for the life of me, can't get CF to output the expected result.  The API is Aspose and the the instructions are here:

http://www.aspose.com/docs/display/totalcloud/Request+Format

According to their example I need to hash this URL: http://api.aspose.com/1.1/storage/folder/test_folder?appSID=c821f123-1a8b-4b97-925a-9d69a6b2fcd8

Using this Key: 23e9d89a967a5f18142221fa8f7cbcd0

And the result should be:Z98TBrlwdtx3pTa6fWVD/Q0c2dE=

According to the C# example they give the algorithm should be: HMACSHA1 and the encoding: UTF8

I cannot get CF to produce this result.

I've tried using the CF function hmac().

#toBase64(hmac(url,key,"HMACSHA1","UTF8"))# gives me: MjYwMkQxN0EyM0IyMzkxNjNDMDU4QTQyMjc3RDgyNkMyNzM0NTA3OA==

I've also tried suggestions and variations found here:

http://stackoverflow.com/questions/9186773/coldfusion-hmac-sha1-encryption

and Ban Nadel's Crypto.cfc.

What am I missing here?

Views

193

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Jul 07, 2015 0

Have something to add?

Join the conversation