From 62b0fc3fdac1af440d61bb6d197dcd7fc34372b4 Mon Sep 17 00:00:00 2001 From: iNPUTmice Date: Wed, 22 Oct 2014 13:06:46 +0200 Subject: made httpconnection accept aes encrypted files --- src/eu/siacs/conversations/http/HttpConnection.java | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/eu/siacs/conversations/http') 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(); -- cgit v1.2.3