【8.3.0】【security】修复编码解析问题

pull/62/head
stylefeng 2024-10-13 17:19:08 +08:00
parent 521e182672
commit dcd2865449
1 changed files with 2 additions and 2 deletions

View File

@ -87,7 +87,7 @@ public class GuomiUtil {
*/ */
public static String sm4Encrypt(String text) { public static String sm4Encrypt(String text) {
String sm4Key = GuomiConfigExpander.getSM4Key(); String sm4Key = GuomiConfigExpander.getSM4Key();
SM4 sm4 = SmUtil.sm4(sm4Key.getBytes()); SM4 sm4 = SmUtil.sm4(Base64.decode(sm4Key));
return sm4.encryptBase64(text, StandardCharsets.UTF_8); return sm4.encryptBase64(text, StandardCharsets.UTF_8);
} }
@ -99,7 +99,7 @@ public class GuomiUtil {
*/ */
public static String sm4Decrypt(String encryptedStr) { public static String sm4Decrypt(String encryptedStr) {
String sm4Key = GuomiConfigExpander.getSM4Key(); String sm4Key = GuomiConfigExpander.getSM4Key();
SM4 sm4 = SmUtil.sm4(sm4Key.getBytes()); SM4 sm4 = SmUtil.sm4(Base64.decode(sm4Key));
return sm4.decryptStr(encryptedStr, StandardCharsets.UTF_8); return sm4.decryptStr(encryptedStr, StandardCharsets.UTF_8);
} }