I am trying to verify the signature of the webhook 2 call Im using java but it doesnt appear to be working. Here is my code
String secret = "Hidden for post";
String message = bodyOfRequest;
Mac sha256_HMAC = Mac.getInstance("HmacSHA256");
SecretKeySpec secret_key = new SecretKeySpec(secret.getBytes(), "HmacSHA256");
sha256_HMAC.init(secret_key);
String hash = Base64.encodeBase64String(sha256_HMAC.doFinal(message.getBytes()));
logger.info(String.format("Primiary signature: %s from hash: %s", boxSigPrimary, hash));
if (!hash.equals(boxSigPrimary)){
logger.info("hash doesnt match");
}
However the hash never matches what am I doing wrong?