aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/de/thedevstack/conversationsplus/entities/FileParams.java24
1 files changed, 13 insertions, 11 deletions
diff --git a/src/main/java/de/thedevstack/conversationsplus/entities/FileParams.java b/src/main/java/de/thedevstack/conversationsplus/entities/FileParams.java
index 290b87b8..3abb37e4 100644
--- a/src/main/java/de/thedevstack/conversationsplus/entities/FileParams.java
+++ b/src/main/java/de/thedevstack/conversationsplus/entities/FileParams.java
@@ -93,17 +93,19 @@ public class FileParams {
}
public void setKeyAndIv(byte[] keyIvCombo) {
- if (keyIvCombo.length == 48) {
- 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) {
- this.aeskey = new byte[32];
- System.arraycopy(keyIvCombo, 0, aeskey, 0, 32);
- } else if (keyIvCombo.length >= 16) {
- this.aeskey = new byte[16];
- System.arraycopy(keyIvCombo, 0, this.aeskey, 0, 16);
+ if (null != keyIvCombo) {
+ if (keyIvCombo.length == 48) {
+ 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) {
+ this.aeskey = new byte[32];
+ System.arraycopy(keyIvCombo, 0, aeskey, 0, 32);
+ } else if (keyIvCombo.length >= 16) {
+ this.aeskey = new byte[16];
+ System.arraycopy(keyIvCombo, 0, this.aeskey, 0, 16);
+ }
}
}