From e914d17aca5a4031a509e25f1adda242d844a9b3 Mon Sep 17 00:00:00 2001 From: luccioman Date: Mon, 23 Apr 2018 08:07:56 +0200 Subject: [PATCH] Updated call to function deprecated since commons-codec version 1.11 --- source/net/yacy/data/TransactionManager.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/source/net/yacy/data/TransactionManager.java b/source/net/yacy/data/TransactionManager.java index e91145b48..92543df16 100644 --- a/source/net/yacy/data/TransactionManager.java +++ b/source/net/yacy/data/TransactionManager.java @@ -25,6 +25,7 @@ import java.nio.charset.StandardCharsets; import java.security.MessageDigest; import java.util.UUID; +import org.apache.commons.codec.digest.HmacAlgorithms; import org.apache.commons.codec.digest.HmacUtils; import net.yacy.cora.order.Base64Order; @@ -133,7 +134,8 @@ public class TransactionManager { * (no need to store tokens until they are consumed). * On the other hand, it is supposed to remain hard enough to forge because the secret key and token seed * are initialized with a random value at each server startup */ - final String token = HmacUtils.hmacSha1Hex(SIGNING_KEY, TOKEN_SEED + userName + path); + final String token = new HmacUtils(HmacAlgorithms.HMAC_SHA_1, SIGNING_KEY) + .hmacHex(TOKEN_SEED + userName + path); return token; @@ -168,7 +170,8 @@ public class TransactionManager { throw new TemplateMissingParameterException("Missing transaction token."); } - final String token = HmacUtils.hmacSha1Hex(SIGNING_KEY, TOKEN_SEED + userName + header.getPathInfo()); + final String token = new HmacUtils(HmacAlgorithms.HMAC_SHA_1, SIGNING_KEY) + .hmacHex(TOKEN_SEED + userName + header.getPathInfo()); /* Compare the server generated token with the one received in the post parameters, * using a time constant function */