From cd5b639a826ccafe5741a51f10cc8ca76ebfdd14 Mon Sep 17 00:00:00 2001 From: Marvin W Date: Mon, 14 Sep 2020 21:56:58 +0200 Subject: Send OMEMO-encrypted messages and files using 12 byte IV --- plugins/omemo/src/logic/trust_manager.vala | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'plugins/omemo/src/logic') diff --git a/plugins/omemo/src/logic/trust_manager.vala b/plugins/omemo/src/logic/trust_manager.vala index a1d85199..1e61b201 100644 --- a/plugins/omemo/src/logic/trust_manager.vala +++ b/plugins/omemo/src/logic/trust_manager.vala @@ -145,6 +145,8 @@ public class TrustManager { } public EncryptState encrypt(MessageStanza message, Jid self_jid, Gee.List recipients, XmppStream stream, Account account) { + const uint KEY_SIZE = 16; + const uint IV_SIZE = 12; EncryptState status = new EncryptState(); if (!Plugin.ensure_context()) return status; if (message.to == null) return status; @@ -153,9 +155,9 @@ public class TrustManager { try { //Create a key and use it to encrypt the message - uint8[] key = new uint8[16]; + uint8[] key = new uint8[KEY_SIZE]; Plugin.get_context().randomize(key); - uint8[] iv = new uint8[16]; + uint8[] iv = new uint8[IV_SIZE]; Plugin.get_context().randomize(iv); uint8[] aes_encrypt_result = aes_encrypt(Cipher.AES_GCM_NOPADDING, key, iv, message.body.data); -- cgit v1.2.3-54-g00ecf