mirror of
https://github.com/moparisthebest/Conversations
synced 2024-11-24 17:52:17 -05:00
Encrypt files for HTTP upload in encrypted chats
This commit is contained in:
parent
6f67469bda
commit
ec0aff4ed7
@ -70,7 +70,8 @@ public class HttpDownloadConnection implements Transferable {
|
||||
String secondToLast = parts.length >= 2 ? parts[parts.length -2] : null;
|
||||
if ("pgp".equals(lastPart) || "gpg".equals(lastPart)) {
|
||||
this.message.setEncryption(Message.ENCRYPTION_PGP);
|
||||
} else if (message.getEncryption() != Message.ENCRYPTION_OTR) {
|
||||
} else if (message.getEncryption() != Message.ENCRYPTION_OTR
|
||||
&& message.getEncryption() != Message.ENCRYPTION_AXOLOTL) {
|
||||
this.message.setEncryption(Message.ENCRYPTION_NONE);
|
||||
}
|
||||
String extension;
|
||||
@ -86,7 +87,8 @@ public class HttpDownloadConnection implements Transferable {
|
||||
this.file.setKey(CryptoHelper.hexToBytes(reference));
|
||||
}
|
||||
|
||||
if (this.message.getEncryption() == Message.ENCRYPTION_OTR
|
||||
if ((this.message.getEncryption() == Message.ENCRYPTION_OTR
|
||||
|| this.message.getEncryption() == Message.ENCRYPTION_AXOLOTL)
|
||||
&& this.file.getKey() == null) {
|
||||
this.message.setEncryption(Message.ENCRYPTION_NONE);
|
||||
}
|
||||
|
@ -88,7 +88,9 @@ public class HttpUploadConnection implements Transferable {
|
||||
this.file = mXmppConnectionService.getFileBackend().getFile(message, false);
|
||||
this.file.setExpectedSize(this.file.getSize());
|
||||
|
||||
if (Config.ENCRYPT_ON_HTTP_UPLOADED) {
|
||||
if (Config.ENCRYPT_ON_HTTP_UPLOADED
|
||||
|| message.getEncryption() == Message.ENCRYPTION_AXOLOTL
|
||||
|| message.getEncryption() == Message.ENCRYPTION_OTR) {
|
||||
this.key = new byte[48];
|
||||
mXmppConnectionService.getRNG().nextBytes(this.key);
|
||||
this.file.setKey(this.key);
|
||||
|
Loading…
Reference in New Issue
Block a user