This commit is contained in:
Looly
2024-02-10 08:43:19 +08:00
parent e948273f2d
commit 115b15f010
3 changed files with 190 additions and 161 deletions

View File

@@ -14,8 +14,8 @@ package org.dromara.hutool.crypto;
import org.bouncycastle.crypto.AlphabetMapper;
import org.dromara.hutool.core.array.ArrayUtil;
import org.dromara.hutool.core.codec.binary.HexUtil;
import org.dromara.hutool.core.codec.binary.Base64;
import org.dromara.hutool.core.codec.binary.Hex;
import org.dromara.hutool.core.lang.Validator;
import org.dromara.hutool.core.text.StrUtil;
import org.dromara.hutool.core.util.ByteUtil;
@@ -536,7 +536,7 @@ public class SecureUtil {
// issue#I90M9D
// 某些特殊字符串会无法区分Hex还是Base64此处使用系统属性强制关闭Hex解析
final boolean decodeHex = SystemUtil.getBoolean(HUTOOL_CRYPTO_DECODE_HEX, true);
return (decodeHex && Validator.isHex(key)) ? HexUtil.decode(key) : Base64.decode(key);
return (decodeHex && Validator.isHex(key)) ? Hex.decode(key) : Base64.decode(key);
}
/**