AnsweredAssumed Answered

CryptDigest and the problem with the multiline data parameter

Question asked by andrewpokora on Jan 4, 2019
Latest reply on Jan 5, 2019 by fmpdude

I'm trying to integrate FileMaker with Amazon A3. I don't use plugins, because I want to implement the functionality I need only with standard FileMaker functions. I faced the following problem.

 

For authorization on S3, it is necessary to calculate the signature. The signature is a SHA256 Hash (the link to documentation and examples of data: https://docs.aws.amazon.com/en_us/AmazonS3/latest/API/sigv4-query-string-auth.html). At the bottom of this page, there is an example with data (see attachment). I'm targeting him to see if I'm calculating the signature correctly. In FileMaker I calculate it as follows:

 

HexEncode ( CryptDigest ( $data ; "SHA256" ) )

 

If I use a single row as data, everything works fine. The problem came about when the $data should be a FEW lines. For example, the Amazon documentation has the following example:

 

«GET

/test.txt

X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIOSFODNN7EXAMPLE%2F20130524%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20130524T000000Z&X-Amz-Expires=86400&X-Amz-SignedHeaders=host

host:examplebucket.s3.amazonaws.com

 

host

UNSIGNED-PAYLOAD»

 

Function Crypt Digest in FileMaker returns this result:

 

330fe96e16c05438dd424131617a3018bc394e29bda11f6e1cacf06cfc561e42

 

However, the Amazon example should have the following:

 

3bfa292879f6447bbcda7001decf97f4a54dc650c8942174ae0a9121cf58ad04.

 

I checked the result in the online calculator

https://www.xorbin.com/tools/sha256-hash-calculator and get following:

 

3bfa292879f6447bbcda7001decf97f4a54dc650c8942174ae0a9121cf58ad04.

 

Since this is the same as the result given in the Amazon example, I tend to think that I'm doing something wrong in FileMaker.  The documentation on Amazon talks about the “\n " character to move to the next line. In FileMaker, I tried using “\n”, the symbol "¶", but without any success.

 

What am I doing wrong? Does anyone have experience passing a multiline data parameter?

Attachments

Outcomes