修复sm4加密时异常处理
This commit is contained in:
parent
00a719d9ba
commit
817f722332
|
|
@ -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; // 发生异常时返回传入字符串
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue