Skip to content

Commit 0a0d950

Browse files
Update HttpsConnectWebhookhMacValidation.java
Signed-off-by: CassandraLoewen <[email protected]>
1 parent acecdd6 commit 0a0d950

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/main/java/com/docusign/HttpsConnectWebhookhMacValidation.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,11 @@ public class HttpsConnectWebhookhMacValidation {
2626
*/
2727
//ds-snippet-start:Connect1Step1
2828
private static String ComputeHash(String secret, byte[] payload)
29-
throws InvalidKeyException, NoSuchAlgorithmException {
29+
throws InvalidKeyException, NoSuchAlgorithmException, UnsupportedEncodingException {
3030
String digest = "HmacSHA256";
3131
Mac mac = Mac.getInstance(digest);
32-
mac.init(new SecretKeySpec(secret.getBytes(), digest));
33-
String base64Hash = new String(Base64.getEncoder().encode(mac.doFinal(payload)));
34-
return base64Hash;
32+
mac.init(new SecretKeySpec(secret.getBytes("UTF-8"), digest));
33+
return Base64.getEncoder().encodeToString(mac.doFinal(payload));
3534
}
3635

3736
public static boolean HashIsValid(String secret, byte[] payload, String verify)

0 commit comments

Comments
 (0)