OMEMO: generate IV more flexible
This commit is contained in:
parent
c6c904cc3e
commit
8a74aec32a
|
@ -277,8 +277,13 @@ public class OmemoMessageBuilder<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey, T_
|
||||||
* @return iv
|
* @return iv
|
||||||
*/
|
*/
|
||||||
public static byte[] generateIv() {
|
public static byte[] generateIv() {
|
||||||
|
// TODO: Switch to 12 once ChatSecure supports decrypting msgs with 12 byte IV.
|
||||||
|
return generateIv(16);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static byte[] generateIv(int len) {
|
||||||
SecureRandom random = new SecureRandom();
|
SecureRandom random = new SecureRandom();
|
||||||
byte[] iv = new byte[16];
|
byte[] iv = new byte[len];
|
||||||
random.nextBytes(iv);
|
random.nextBytes(iv);
|
||||||
return iv;
|
return iv;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue