|
|
@@ -53,6 +53,22 @@ public class AesUtils {
|
|
|
return new String(Base64.getEncoder().encode(encryptedBytes));
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * aes 解密
|
|
|
+ *
|
|
|
+ * @param data
|
|
|
+ * @param SECRET_KEY
|
|
|
+ * @return
|
|
|
+ * @throws Exception
|
|
|
+ */
|
|
|
+ public static String decryptAes(String data, String SECRET_KEY) throws Exception {
|
|
|
+ Cipher cipher = Cipher.getInstance("AES");
|
|
|
+ SecretKeySpec secretKeySpec = new SecretKeySpec(SECRET_KEY.getBytes(), "AES");
|
|
|
+ cipher.init(Cipher.DECRYPT_MODE, secretKeySpec);
|
|
|
+ byte[] encryptedBytes = cipher.doFinal(data.getBytes());
|
|
|
+ return new String(Base64.getDecoder().decode(encryptedBytes));
|
|
|
+ }
|
|
|
+
|
|
|
@SneakyThrows
|
|
|
public static String signMacSHA256(String str, String key) {
|
|
|
Mac mac = Mac.getInstance("HmacSHA256");
|