Skip to content

Commit 4fa1058

Browse files
committed
Use commons-codec instead of jaxb-api
This is needed to remove the dependency from javax.xml.bind
1 parent a7a7d47 commit 4fa1058

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

src/main/java/com/adyen/util/HMACValidator.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
*
1515
* Adyen Java API Library
1616
*
17-
* Copyright (c) 2017 Adyen B.V.
17+
* Copyright (c) 2026 Adyen B.V.
1818
* This file is open source and available under the MIT license.
1919
* See the LICENSE file for more info.
2020
*/
@@ -31,8 +31,8 @@
3131
import java.util.List;
3232
import javax.crypto.Mac;
3333
import javax.crypto.spec.SecretKeySpec;
34-
import javax.xml.bind.DatatypeConverter;
3534
import org.apache.commons.codec.binary.Base64;
35+
import org.apache.commons.codec.binary.Hex;
3636

3737
/** Utility class for generating and validating HMAC signatures used in Adyen webhooks. */
3838
public class HMACValidator {
@@ -61,7 +61,7 @@ public String calculateHMAC(String data, String key)
6161
throw new IllegalArgumentException("HMAC key is not provided");
6262
}
6363

64-
byte[] rawKey = DatatypeConverter.parseHexBinary(key);
64+
byte[] rawKey = Hex.decodeHex(key);
6565
SecretKeySpec signingKey = new SecretKeySpec(rawKey, HMAC_SHA256_ALGORITHM);
6666

6767
Mac mac = Mac.getInstance(HMAC_SHA256_ALGORITHM);

0 commit comments

Comments
 (0)