aboutsummaryrefslogtreecommitdiff
path: root/plugins/omemo/src/logic/trust_manager.vala
diff options
context:
space:
mode:
authorMarvin W <git@larma.de>2020-09-14 21:56:58 +0200
committerMarvin W <git@larma.de>2020-09-14 22:04:06 +0200
commitcd5b639a826ccafe5741a51f10cc8ca76ebfdd14 (patch)
treef39146eb751f67e99942770c67cf06ca4a912243 /plugins/omemo/src/logic/trust_manager.vala
parentf6943a4c82ed39b8d6ae866855198596a51dade4 (diff)
downloaddino-cd5b639a826ccafe5741a51f10cc8ca76ebfdd14.tar.gz
dino-cd5b639a826ccafe5741a51f10cc8ca76ebfdd14.zip
Send OMEMO-encrypted messages and files using 12 byte IV
Diffstat (limited to 'plugins/omemo/src/logic/trust_manager.vala')
-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);