From 4c08ba8d0397361e339344a77a28de456c9a2f40 Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Wed, 3 Oct 2018 17:44:48 +0200 Subject: [PATCH] use 12 byte IV for omemo and http upload --- .../siacs/conversations/crypto/axolotl/XmppAxolotlMessage.java | 2 +- .../java/eu/siacs/conversations/http/HttpUploadConnection.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/eu/siacs/conversations/crypto/axolotl/XmppAxolotlMessage.java b/src/main/java/eu/siacs/conversations/crypto/axolotl/XmppAxolotlMessage.java index 9b7d10008..1852bf183 100644 --- a/src/main/java/eu/siacs/conversations/crypto/axolotl/XmppAxolotlMessage.java +++ b/src/main/java/eu/siacs/conversations/crypto/axolotl/XmppAxolotlMessage.java @@ -168,7 +168,7 @@ public class XmppAxolotlMessage { private static byte[] generateIv() { SecureRandom random = new SecureRandom(); - byte[] iv = new byte[16]; + byte[] iv = new byte[12]; random.nextBytes(iv); return iv; } diff --git a/src/main/java/eu/siacs/conversations/http/HttpUploadConnection.java b/src/main/java/eu/siacs/conversations/http/HttpUploadConnection.java index 0948280e6..b635ab923 100644 --- a/src/main/java/eu/siacs/conversations/http/HttpUploadConnection.java +++ b/src/main/java/eu/siacs/conversations/http/HttpUploadConnection.java @@ -110,7 +110,7 @@ public class HttpUploadConnection implements Transferable { if (Config.ENCRYPT_ON_HTTP_UPLOADED || message.getEncryption() == Message.ENCRYPTION_AXOLOTL || 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); this.file.setKeyAndIv(this.key); }