aboutsummaryrefslogtreecommitdiffstats
path: root/src/eu/siacs/conversations/http
diff options
context:
space:
mode:
authoriNPUTmice <daniel@gultsch.de>2014-10-22 13:06:46 +0200
committeriNPUTmice <daniel@gultsch.de>2014-10-22 13:06:46 +0200
commit62b0fc3fdac1af440d61bb6d197dcd7fc34372b4 (patch)
tree9bda78ccbc7e7c10f2f643f9bf67eadf33c23443 /src/eu/siacs/conversations/http
parent45bdadd915ed0e0135de16876f9842b3401f1ac4 (diff)
made httpconnection accept aes encrypted files
Diffstat (limited to 'src/eu/siacs/conversations/http')
-rw-r--r--src/eu/siacs/conversations/http/HttpConnection.java9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/eu/siacs/conversations/http/HttpConnection.java b/src/eu/siacs/conversations/http/HttpConnection.java
index 467b6a805..407a13d94 100644
--- a/src/eu/siacs/conversations/http/HttpConnection.java
+++ b/src/eu/siacs/conversations/http/HttpConnection.java
@@ -27,6 +27,7 @@ import eu.siacs.conversations.entities.Downloadable;
import eu.siacs.conversations.entities.DownloadableFile;
import eu.siacs.conversations.entities.Message;
import eu.siacs.conversations.services.XmppConnectionService;
+import eu.siacs.conversations.utils.CryptoHelper;
public class HttpConnection implements Downloadable {
@@ -64,6 +65,14 @@ public class HttpConnection implements Downloadable {
mUrl = new URL(message.getBody());
this.file = mXmppConnectionService.getFileBackend().getFile(
message, false);
+ String reference = mUrl.getRef();
+ if (reference != null && reference.length() == 96) {
+ this.file.setKey(CryptoHelper.hexToBytes(reference));
+ }
+ if (this.message.getEncryption() == Message.ENCRYPTION_OTR
+ && this.file.getKey() == null) {
+ this.message.setEncryption(Message.ENCRYPTION_NONE);
+ }
checkFileSize(false);
} catch (MalformedURLException e) {
this.cancel();