use 12 byte IV for omemo and http upload

This commit is contained in:
Daniel Gultsch 2018-10-03 17:44:48 +02:00
parent 9ca636589c
commit 4c08ba8d03
2 changed files with 2 additions and 2 deletions

View file

@ -168,7 +168,7 @@ public class XmppAxolotlMessage {
private static byte[] generateIv() { private static byte[] generateIv() {
SecureRandom random = new SecureRandom(); SecureRandom random = new SecureRandom();
byte[] iv = new byte[16]; byte[] iv = new byte[12];
random.nextBytes(iv); random.nextBytes(iv);
return iv; return iv;
} }

View file

@ -110,7 +110,7 @@ public class HttpUploadConnection implements Transferable {
if (Config.ENCRYPT_ON_HTTP_UPLOADED if (Config.ENCRYPT_ON_HTTP_UPLOADED
|| message.getEncryption() == Message.ENCRYPTION_AXOLOTL || message.getEncryption() == Message.ENCRYPTION_AXOLOTL
|| message.getEncryption() == Message.ENCRYPTION_OTR) { || message.getEncryption() == Message.ENCRYPTION_OTR) {
this.key = new byte[48]; // todo: change this to 44 for 12-byte IV instead of 16-byte at some point in future this.key = new byte[44];
mXmppConnectionService.getRNG().nextBytes(this.key); mXmppConnectionService.getRNG().nextBytes(this.key);
this.file.setKeyAndIv(this.key); this.file.setKeyAndIv(this.key);
} }