|
@@ -7,7 +7,6 @@ import cn.hutool.crypto.asymmetric.KeyType;
|
|
|
import cn.hutool.crypto.asymmetric.RSA;
|
|
import cn.hutool.crypto.asymmetric.RSA;
|
|
|
import cn.hutool.crypto.digest.MD5;
|
|
import cn.hutool.crypto.digest.MD5;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
-import lombok.extern.slf4j.XSlf4j;
|
|
|
|
|
import org.apache.commons.codec.digest.DigestUtils;
|
|
import org.apache.commons.codec.digest.DigestUtils;
|
|
|
import org.dromara.common.core.constant.CacheNames;
|
|
import org.dromara.common.core.constant.CacheNames;
|
|
|
import org.dromara.common.core.utils.DigitUtils;
|
|
import org.dromara.common.core.utils.DigitUtils;
|
|
@@ -16,8 +15,6 @@ import org.dromara.common.redis.utils.RedisUtils;
|
|
|
import javax.crypto.Cipher;
|
|
import javax.crypto.Cipher;
|
|
|
import javax.crypto.spec.SecretKeySpec;
|
|
import javax.crypto.spec.SecretKeySpec;
|
|
|
import java.nio.charset.StandardCharsets;
|
|
import java.nio.charset.StandardCharsets;
|
|
|
-import java.util.HashMap;
|
|
|
|
|
-import java.util.Map;
|
|
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* name: YcEncryptUtil
|
|
* name: YcEncryptUtil
|
|
@@ -127,14 +124,11 @@ public class YcEncryptUtil extends EncryptUtils {
|
|
|
public static String getBalanceSecretKey(String publicKey, String data) {
|
|
public static String getBalanceSecretKey(String publicKey, String data) {
|
|
|
String secretKey;
|
|
String secretKey;
|
|
|
String cacheKey = CacheNames.USER_SECRET_KEY + ":" + data;
|
|
String cacheKey = CacheNames.USER_SECRET_KEY + ":" + data;
|
|
|
- log.info("[卡余加密缓存KEY]-[{}]",cacheKey);
|
|
|
|
|
if (ObjectUtil.isNotNull(RedisUtils.getCacheObject(cacheKey))) {
|
|
if (ObjectUtil.isNotNull(RedisUtils.getCacheObject(cacheKey))) {
|
|
|
secretKey = RedisUtils.getCacheObject(cacheKey).toString();
|
|
secretKey = RedisUtils.getCacheObject(cacheKey).toString();
|
|
|
- log.info("[缓存获取到的密钥]-[{}]",secretKey);
|
|
|
|
|
} else {
|
|
} else {
|
|
|
String md5DigestData = getMd5DigestData(publicKey);
|
|
String md5DigestData = getMd5DigestData(publicKey);
|
|
|
secretKey = encryptByMd5WidthAes(data, md5DigestData, false);
|
|
secretKey = encryptByMd5WidthAes(data, md5DigestData, false);
|
|
|
- log.info("[生成的密钥]-[{}]",secretKey);
|
|
|
|
|
RedisUtils.setCacheObject(cacheKey, secretKey);
|
|
RedisUtils.setCacheObject(cacheKey, secretKey);
|
|
|
}
|
|
}
|
|
|
|
|
|