CryptoAPI / ComputeMAC Hash not Matching

CryptoAPI / ComputeMAC Hash not Matching

  

This is a follow on post to one previously asked incorrectly.

I have simplified the action to include the Request.RequestText from the API method.  The screen shot shows the text being used by ComputeMac to calculate the Mac_Hex which is also shown.
RequestText:
"{""database"":""tracking"",""collection"":""jobs"",""limit"":10,""querystr"":""""}"

MacHash:
68C904C4195F115711C7243048F38A65EC55B59FB3CA4972511DDB9AC7ACC068

This is the actual JSON that is being passed in the message body as found in environment monitoring for the request:
{"database":"tracking","collection":"jobs","limit":10,"querystr":""} 
which matches exactly save the escaped quotes and opening and closing quotes.  

The hash i get from online sources with the JSON above is:
ff97384b13fd5b6b0ec336bcff25e50d0c8ab628f012201a529f7141a820e20a

I am at a loss on how to proceed.


Hi,


Can you put up a simple example oml, because that would make the investigation easier.

Btw, you are talking about Mac and Hash, and in CryptoAPI there are also 2 methods "ComputeHash" and "ComputeMAC"


And what online sources are you comparing?


please remind also that if they or you use different encodings on the string, there could be an issue as well of course (utf-8 vs. utf-16 comes to mind)



Hello Tony,

In ComputeMac I use a very specific key derivation. I seriously doubt this is the action you want to use to integrate with third party systems, or that an online tool will match this output.

If you can produce the MAC Key in binary form, you may be able to use KComputeMac for what you want.

Can you be a bit more specific with what you're trying to do?

I am also not getting the correct Hash string.  I am hashing   (using ComputeHash) :

GET
/
Param1=value1&Param2=value2
host:example.amazonaws.com
x-amz-date:20150830T123600Z

host;x-amz-date
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855


I am getting :

9E487D40177520AED8763D24C77C7179F67622DEBBD2B8188D93138BA6748ADE

instead of 

816cd5b414d056048ba4f7c5386d6e0533120fb1fcfa93762cf0fc39e2cf19e0


do I need to encode the text in any way? (i.e. json format ,  )

The issue seems to be with the line feeds I have in the text. Single lines seem to hash correctly, but multiple lines of text do not.

I think I found the way around this issue with the newline:  use  

SyntaxEditor Code Snippet

 Chr(10)

functiion instead of newline()