1.新增签名日志

This commit is contained in:
chenbowen
2026-01-07 15:49:10 +08:00
parent 09c9276deb
commit 64de518d4c

View File

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