AnsweredAssumed Answered

Issues With Base64Encode and CryptAuthCode

Question asked by LSNOVER on Aug 16, 2018
Latest reply on Aug 16, 2018 by LSNOVER

Hi Folks:

 

I need some help from you Web page gurus.   I am building a REST API interface to a system that requires I send an Encrypted/Encoded key in the header for security.  I have it mostly working, but I am running into one odd issue.

 

I set a "signature" variable using the following calculation (it has been redacted for security purposes)

 

Base64Encode ( CryptAuthCode (  "POSTapplication/json2018-08-03 13:37:45 -0500/api/v3/updatesJJJBBBNNNWWWWXX" ; "sha1";"mykey" ) )

 

This works, and I get a value back such as "vLTHiiiuuuVe6EHgXNEa2YL4lyA="  which is essentially the right value.

 

The problem is that Filemaker is giving me the result with a LineFeed/Carriage Return character at the end, and it doesn't seem to be 100% consistent.   Also, my normal tests for looking for these characters using something like "Substitute($signature, char(10), "")"  doesn't work.   I've checked the text, and I'm getting the ASCII code 10 and 13 at the end of the string, but I can't seem to pull them out.   I tried getting rid of the last character or two characters based on the length of the string, but that doesn't seem to work consistently.    This has me a tad frustrated.

 

In other environments, there is a version of the Base64Encode that specifically excludes any kind of "end of line" marker being included.   I'm sure I'm missing something simple, but I haven't been able to pin it down.

 

Kind regards,

Lee

Outcomes