Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

In using webhooks, I am trying to validate the secret via my grails 5.3.3 application.

Steven Keck September 19, 2023

But I can't seem to generate the same hash value. 

I'm using the same secret. Encoding is utf-8.

I've insured the order of my body is the same as what is being sent by the webhook.

Here is the method I'm using: 

def generateHmac(String secretKey, String data) {
Mac mac = Mac.getInstance("HmacSHA256")
SecretKeySpec secretKeySpec = new SecretKeySpec(secretKey.getBytes(), "HmacSHA256")
mac.init(secretKeySpec)
byte[] hmacBytes = mac.doFinal(data.getBytes("UTF-8"))

return DatatypeConverter.printHexBinary(hmacBytes)
}

I've tried several different variations of this to no effect.
I know you can get different values based on the libraries you use.

Any suggestions as to help resolve this would be great.

Thanks,

0 answers

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events