在使用指纹扫描器进行用户身份验证之后,我需要加密不同的字符串和相关的解密.
private boolean tryEncrypt(Cipher cipher) {
try {
cipher.doFinal(SECRET_BYTES);
String one = "augusto";
String two = "test@gmail";
String three = "3333333331";
byte[] oneEnc = cipher.Bytes());
byte[] twoEnc = cipher.Bytes());
byte[] threeEnc = cipher.Bytes());
Log.d("test", "oneEnc: " + deToString(oneEnc,0));
Log.d("test", "twoEnc: " + deToString(twoEnc,0));
Log.d("test", "threeEnc: " + deToString(threeEnc,0));
} catch (Exception e) {
e.printStackTrace();
return false;
}
return true;
}
我收到此错误:
java.lang.IllegalStateException: IV has already been used. Reusing IV in encryption mode violates security best practices.
正确的做法是什么?
谢谢
*******************更新:*****************************
为了帮助其他人解决此问题,我使用了这个库并像魅力一样工作:
本文发布于:2024-02-04 10:22:00,感谢您对本站的认可!
本文链接:https://www.4u4v.net/it/170704993054717.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
留言与评论(共有 0 条评论) |