Skip to content

Commit

Permalink
OMEMO: generate IV more flexible
Browse files Browse the repository at this point in the history
  • Loading branch information
vanitasvitae committed Jun 30, 2019
1 parent c6c904c commit 8a74aec
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -277,8 +277,13 @@ public static byte[] generateKey(String keyType, int keyLength) throws NoSuchAlg
* @return iv
*/
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();
byte[] iv = new byte[16];
byte[] iv = new byte[len];
random.nextBytes(iv);
return iv;
}
Expand Down

0 comments on commit 8a74aec

Please sign in to comment.