Merge remote-tracking branch 'base-version/main' into dev
This commit is contained in:
@@ -2,6 +2,7 @@ package com.zt.plat.framework.common.util.security;
|
||||
|
||||
import cn.hutool.crypto.SecureUtil;
|
||||
import com.zt.plat.framework.common.util.json.JsonUtils;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import javax.crypto.Cipher;
|
||||
import javax.crypto.KeyGenerator;
|
||||
@@ -15,6 +16,7 @@ import java.util.*;
|
||||
/**
|
||||
* 通用的签名、加解密工具类
|
||||
*/
|
||||
@Slf4j
|
||||
public final class CryptoSignatureUtils {
|
||||
|
||||
public static final String ENCRYPT_TYPE_AES = "AES";
|
||||
@@ -142,6 +144,7 @@ public final class CryptoSignatureUtils {
|
||||
return false;
|
||||
}
|
||||
String computed;
|
||||
log.info("原始签名串:{}", sb);
|
||||
if (SIGNATURE_TYPE_MD5.equalsIgnoreCase(type)) {
|
||||
computed = SecureUtil.md5(sb.toString());
|
||||
} else if (SIGNATURE_TYPE_SHA256.equalsIgnoreCase(type)) {
|
||||
@@ -149,6 +152,8 @@ public final class CryptoSignatureUtils {
|
||||
} else {
|
||||
throw new IllegalArgumentException("Unsupported signature type: " + type);
|
||||
}
|
||||
log.info("原始签名:{}", computed);
|
||||
log.info("请求签名:{}", provided);
|
||||
return provided.equalsIgnoreCase(computed);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user