function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Mike Borozdin.ax1408Mike Borozdin.ax1408 

Issues with Crypto.generateMac()

Hi,

 

We need to make a few callouts to a service that is using OAuth 1.0 and requires each request to be signed with HMAC-SHA1.

 

The service doesn't have any APEX client API. Thus, we have to do it manually.

 

Unfortunately, 

 

EncodingUtil.base64Encode(Crypto.generateMac('hmacSHA1', Blob.valueOf(data), Blob.valueOf(key)));

 returns a different string from what we expect. We have compared the output for the same input with libraries for other languages. And the output was different.

RiellRiell

I am having the same problem using Crypto.generateMac('HMACSHA256', Blob.valueOf(inputData), Blob.valueOf(AuthenticationKey)); and comparing to a .NET HMACSHA256 for the same input.

 

@altius_rup@altius_rup

Same problem for me : anyone found a workaround ?

Rup

Jairaj SinghJairaj Singh
Any response or I will take JS route :)