mirror of
https://github.com/moparisthebest/Conversations
synced 2024-11-15 13:35:04 -05:00
made setting aes keys in DownloadableFile more readable
This commit is contained in:
parent
d115f38361
commit
343a6b4e6b
@ -52,20 +52,16 @@ public class DownloadableFile extends File {
|
|||||||
|
|
||||||
public void setKeyAndIv(byte[] keyIvCombo) {
|
public void setKeyAndIv(byte[] keyIvCombo) {
|
||||||
if (keyIvCombo.length == 48) {
|
if (keyIvCombo.length == 48) {
|
||||||
byte[] secretKey = new byte[32];
|
this.aeskey = new byte[32];
|
||||||
byte[] iv = new byte[16];
|
this.iv = new byte[16];
|
||||||
System.arraycopy(keyIvCombo, 0, iv, 0, 16);
|
System.arraycopy(keyIvCombo, 0, this.iv, 0, 16);
|
||||||
System.arraycopy(keyIvCombo, 16, secretKey, 0, 32);
|
System.arraycopy(keyIvCombo, 16, this.aeskey, 0, 32);
|
||||||
this.aeskey = secretKey;
|
|
||||||
this.iv = iv;
|
|
||||||
} else if (keyIvCombo.length >= 32) {
|
} else if (keyIvCombo.length >= 32) {
|
||||||
byte[] secretKey = new byte[32];
|
this.aeskey = new byte[32];
|
||||||
System.arraycopy(keyIvCombo, 0, secretKey, 0, 32);
|
System.arraycopy(keyIvCombo, 0, aeskey, 0, 32);
|
||||||
this.aeskey = secretKey;
|
|
||||||
} else if (keyIvCombo.length >= 16) {
|
} else if (keyIvCombo.length >= 16) {
|
||||||
byte[] secretKey = new byte[16];
|
this.aeskey = new byte[16];
|
||||||
System.arraycopy(keyIvCombo, 0, secretKey, 0, 16);
|
System.arraycopy(keyIvCombo, 0, this.aeskey, 0, 16);
|
||||||
this.aeskey = secretKey;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user