From 343a6b4e6b75d9ca0faef0ae317200ef695a624c Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Thu, 31 Mar 2016 13:55:25 +0200 Subject: made setting aes keys in DownloadableFile more readable --- .../conversations/entities/DownloadableFile.java | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/src/main/java/eu/siacs/conversations/entities/DownloadableFile.java b/src/main/java/eu/siacs/conversations/entities/DownloadableFile.java index d35a4b01..4e63a66a 100644 --- a/src/main/java/eu/siacs/conversations/entities/DownloadableFile.java +++ b/src/main/java/eu/siacs/conversations/entities/DownloadableFile.java @@ -52,20 +52,16 @@ public class DownloadableFile extends File { public void setKeyAndIv(byte[] keyIvCombo) { if (keyIvCombo.length == 48) { - byte[] secretKey = new byte[32]; - byte[] iv = new byte[16]; - System.arraycopy(keyIvCombo, 0, iv, 0, 16); - System.arraycopy(keyIvCombo, 16, secretKey, 0, 32); - this.aeskey = secretKey; - this.iv = iv; + this.aeskey = new byte[32]; + this.iv = new byte[16]; + System.arraycopy(keyIvCombo, 0, this.iv, 0, 16); + System.arraycopy(keyIvCombo, 16, this.aeskey, 0, 32); } else if (keyIvCombo.length >= 32) { - byte[] secretKey = new byte[32]; - System.arraycopy(keyIvCombo, 0, secretKey, 0, 32); - this.aeskey = secretKey; + this.aeskey = new byte[32]; + System.arraycopy(keyIvCombo, 0, aeskey, 0, 32); } else if (keyIvCombo.length >= 16) { - byte[] secretKey = new byte[16]; - System.arraycopy(keyIvCombo, 0, secretKey, 0, 16); - this.aeskey = secretKey; + this.aeskey = new byte[16]; + System.arraycopy(keyIvCombo, 0, this.aeskey, 0, 16); } } -- cgit v1.2.3