From dcd286544951afa80d3f5427f408a0d1bc256398 Mon Sep 17 00:00:00 2001 From: stylefeng Date: Sun, 13 Oct 2024 17:19:08 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=908.3.0=E3=80=91=E3=80=90security?= =?UTF-8?q?=E3=80=91=E4=BF=AE=E5=A4=8D=E7=BC=96=E7=A0=81=E8=A7=A3=E6=9E=90?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cn/stylefeng/roses/kernel/security/guomi/GuomiUtil.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kernel-d-security/security-sdk-guomi/src/main/java/cn/stylefeng/roses/kernel/security/guomi/GuomiUtil.java b/kernel-d-security/security-sdk-guomi/src/main/java/cn/stylefeng/roses/kernel/security/guomi/GuomiUtil.java index f4d8e8f6f..7e89019b7 100644 --- a/kernel-d-security/security-sdk-guomi/src/main/java/cn/stylefeng/roses/kernel/security/guomi/GuomiUtil.java +++ b/kernel-d-security/security-sdk-guomi/src/main/java/cn/stylefeng/roses/kernel/security/guomi/GuomiUtil.java @@ -87,7 +87,7 @@ public class GuomiUtil { */ public static String sm4Encrypt(String text) { String sm4Key = GuomiConfigExpander.getSM4Key(); - SM4 sm4 = SmUtil.sm4(sm4Key.getBytes()); + SM4 sm4 = SmUtil.sm4(Base64.decode(sm4Key)); return sm4.encryptBase64(text, StandardCharsets.UTF_8); } @@ -99,7 +99,7 @@ public class GuomiUtil { */ public static String sm4Decrypt(String encryptedStr) { String sm4Key = GuomiConfigExpander.getSM4Key(); - SM4 sm4 = SmUtil.sm4(sm4Key.getBytes()); + SM4 sm4 = SmUtil.sm4(Base64.decode(sm4Key)); return sm4.decryptStr(encryptedStr, StandardCharsets.UTF_8); }