aboutsummaryrefslogtreecommitdiff
path: root/plugins/omemo/src/logic
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/omemo/src/logic')
-rw-r--r--plugins/omemo/src/logic/trust_manager.vala6
1 files changed, 4 insertions, 2 deletions
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<Jid> 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);