|
|
@ -2,6 +2,8 @@ package com.ccsens.util; |
|
|
|
|
|
|
|
import cn.hutool.core.codec.Base64; |
|
|
|
import cn.hutool.core.util.CharsetUtil; |
|
|
|
import cn.hutool.core.util.ObjectUtil; |
|
|
|
import cn.hutool.core.util.StrUtil; |
|
|
|
import cn.hutool.crypto.SecureUtil; |
|
|
|
import cn.hutool.crypto.symmetric.SymmetricAlgorithm; |
|
|
|
import cn.hutool.crypto.symmetric.SymmetricCrypto; |
|
|
@ -23,8 +25,12 @@ public class SymmetricCryptoUtil { |
|
|
|
|
|
|
|
/**加密*/ |
|
|
|
public static String encrypt(String key, String value){ |
|
|
|
String encryptString = null; |
|
|
|
if(StrUtil.isNotBlank(key) && StrUtil.isNotBlank(value)){ |
|
|
|
SymmetricCrypto aes = new SymmetricCrypto(SymmetricAlgorithm.AES, Base64.decode(key)); |
|
|
|
return aes.encryptHex(value); |
|
|
|
encryptString = aes.encryptHex(value); |
|
|
|
} |
|
|
|
return encryptString; |
|
|
|
} |
|
|
|
|
|
|
|
/**解密*/ |
|
|
|