修复sm4加密时异常处理

This commit is contained in:
weiweiw 2024-12-20 08:32:28 +08:00
parent 00a719d9ba
commit 817f722332
1 changed files with 2 additions and 2 deletions

View File

@ -29,7 +29,7 @@ public class Sm4Utils {
// 返回带盐的加密结果Hex编码 // 返回带盐的加密结果Hex编码
return HexUtil.encodeHexStr(encryptedData); return HexUtil.encodeHexStr(encryptedData);
} catch (Exception e) { } catch (Exception e) {
return plainText; // 发生异常时返回null return plainText; // 发生异常时返回传入字符串
} }
} }
@ -47,7 +47,7 @@ public class Sm4Utils {
byte[] decryptedData = sm4.decrypt(cipherText); byte[] decryptedData = sm4.decrypt(cipherText);
return new String(decryptedData); return new String(decryptedData);
} catch (Exception e) { } catch (Exception e) {
return cipherText; // 发生异常时返回null return cipherText; // 发生异常时返回传入字符串
} }
} }