aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/de/thedevstack/conversationsplus/entities/FileParams.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/de/thedevstack/conversationsplus/entities/FileParams.java')
-rw-r--r--src/main/java/de/thedevstack/conversationsplus/entities/FileParams.java42
1 files changed, 42 insertions, 0 deletions
diff --git a/src/main/java/de/thedevstack/conversationsplus/entities/FileParams.java b/src/main/java/de/thedevstack/conversationsplus/entities/FileParams.java
index 1eef078f..290b87b8 100644
--- a/src/main/java/de/thedevstack/conversationsplus/entities/FileParams.java
+++ b/src/main/java/de/thedevstack/conversationsplus/entities/FileParams.java
@@ -9,6 +9,7 @@ import eu.siacs.conversations.utils.MimeUtils;
*/
public class FileParams {
private String name;
+ private String originalFilename;
private String path;
private String url;
private String mimeType;
@@ -16,6 +17,8 @@ public class FileParams {
private int width = 0;
private int height = 0;
private FileStatus fileStatus;
+ private byte[] aeskey;
+ private byte[] iv;
public FileParams() {
fileStatus = FileStatus.UNDEFINED;
@@ -89,6 +92,37 @@ public class FileParams {
return path;
}
+ 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);
+ }
+ }
+
+ public void setKey(byte[] key) {
+ this.aeskey = key;
+ }
+
+ public void setIv(byte[] iv) {
+ this.iv = iv;
+ }
+
+ public byte[] getKey() {
+ return this.aeskey;
+ }
+
+ public byte[] getIv() {
+ return this.iv;
+ }
+
/**
* Sets the path to the file.
* If no file name is stored yet here - this method tries to extract the file name from the path.
@@ -127,4 +161,12 @@ public class FileParams {
public FileStatus getFileStatus() {
return this.fileStatus;
}
+
+ public void setOriginalFilename(String originalFilename) {
+ this.originalFilename = originalFilename;
+ }
+
+ public String getOriginalFilename() {
+ return this.originalFilename;
+ }
}