aboutsummaryrefslogtreecommitdiffstats
path: root/src/eu/siacs/conversations/xmpp/jingle/JingleFile.java
diff options
context:
space:
mode:
authoriNPUTmice <daniel@gultsch.de>2014-06-20 17:30:19 +0200
committeriNPUTmice <daniel@gultsch.de>2014-06-20 17:30:19 +0200
commit1cf055d2fdbaa881cfc8ead6b78dc744e9dbe596 (patch)
tree51c0a3463ff3d5f005aeb6dccf6c50d05fddab42 /src/eu/siacs/conversations/xmpp/jingle/JingleFile.java
parentbeafb06b6a59649a4c314db820f5ce30be120e7c (diff)
not working version of otr file transfer
Diffstat (limited to '')
-rw-r--r--src/eu/siacs/conversations/xmpp/jingle/JingleFile.java26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/eu/siacs/conversations/xmpp/jingle/JingleFile.java b/src/eu/siacs/conversations/xmpp/jingle/JingleFile.java
index 21cbd716..fd366754 100644
--- a/src/eu/siacs/conversations/xmpp/jingle/JingleFile.java
+++ b/src/eu/siacs/conversations/xmpp/jingle/JingleFile.java
@@ -1,6 +1,12 @@
package eu.siacs.conversations.xmpp.jingle;
import java.io.File;
+import java.security.Key;
+
+import javax.crypto.spec.SecretKeySpec;
+
+import eu.siacs.conversations.utils.CryptoHelper;
+import android.util.Log;
public class JingleFile extends File {
@@ -8,6 +14,7 @@ public class JingleFile extends File {
private long expectedSize = 0;
private String sha1sum;
+ private Key aeskey;
public JingleFile(String path) {
super(path);
@@ -32,4 +39,23 @@ public class JingleFile extends File {
public void setSha1Sum(String sum) {
this.sha1sum = sum;
}
+
+ public void setKey(byte[] key) {
+ Log.d("xmppService","using aes key "+CryptoHelper.bytesToHex(key));
+ if (key.length>=32) {
+ byte[] secretKey = new byte[32];
+ System.arraycopy(key, 0, secretKey, 0, 32);
+ this.aeskey = new SecretKeySpec(key, "AES");
+ } else if (key.length>=16) {
+ byte[] secretKey = new byte[15];
+ System.arraycopy(key, 0, secretKey, 0, 16);
+ this.aeskey = new SecretKeySpec(key, "AES");
+ } else {
+ Log.d("xmppService","weird key");
+ }
+ }
+
+ public Key getKey() {
+ return this.aeskey;
+ }
}