File tree Expand file tree Collapse file tree 1 file changed +3
-4
lines changed
src/main/java/com/docusign/controller/connect/services Expand file tree Collapse file tree 1 file changed +3
-4
lines changed Original file line number Diff line number Diff line change 1010
1111public final class ValidateUsingHmacService {
1212 public static String computeHash (String secret , byte [] payload )
13- throws InvalidKeyException , NoSuchAlgorithmException {
13+ throws InvalidKeyException , NoSuchAlgorithmException , UnsupportedEncodingException {
1414 String digest = "HmacSHA256" ;
1515 Mac mac = Mac .getInstance (digest );
16- mac .init (new SecretKeySpec (secret .getBytes (), digest ));
17- String base64Hash = new String (Base64 .getEncoder ().encode (mac .doFinal (payload )));
18- return base64Hash ;
16+ mac .init (new SecretKeySpec (secret .getBytes ("UTF-8" ), digest ));
17+ return Base64 .getEncoder ().encodeToString (mac .doFinal (payload ));
1918 }
2019
2120 public static boolean isValid (String secret , byte [] payload , String verify )
You can’t perform that action at this time.
0 commit comments