diff --git a/pigx-common/pigx-common-encrypt-api/src/main/java/com/pig4cloud/pigx/common/api/encrypt/util/ApiCryptoUtil.java b/pigx-common/pigx-common-encrypt-api/src/main/java/com/pig4cloud/pigx/common/api/encrypt/util/ApiCryptoUtil.java index 17a06683e..64612fcfd 100644 --- a/pigx-common/pigx-common-encrypt-api/src/main/java/com/pig4cloud/pigx/common/api/encrypt/util/ApiCryptoUtil.java +++ b/pigx-common/pigx-common-encrypt-api/src/main/java/com/pig4cloud/pigx/common/api/encrypt/util/ApiCryptoUtil.java @@ -123,10 +123,12 @@ public class ApiCryptoUtil { Assert.hasText(secretKey, type + " key is not configured (未配置" + type + ")"); if (type == EncryptType.AES) { - // 构建前端对应解密AES 因子 - AES aes = new AES(Mode.CFB, Padding.NoPadding, new SecretKeySpec(secretKey.getBytes(), "AES"), - new IvParameterSpec(secretKey.getBytes())); - return aes.decrypt(StrUtil.str(bodyData, Charset.defaultCharset())); + + AES aes = new AES(Mode.CFB, Padding.NoPadding, + new SecretKeySpec(secretKey.getBytes(StandardCharsets.UTF_8), "AES"), + new IvParameterSpec(secretKey.getBytes(StandardCharsets.UTF_8))); + return aes.decrypt(StrUtil.str(bodyData, StandardCharsets.UTF_8)); + } if (type == EncryptType.DES) { return SecureUtil.des(secretKey.getBytes(StandardCharsets.UTF_8)).decrypt(bodyData);