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/file_transfer/file_encryptor.vala | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'plugins/omemo/src/file_transfer/file_encryptor.vala') diff --git a/plugins/omemo/src/file_transfer/file_encryptor.vala b/plugins/omemo/src/file_transfer/file_encryptor.vala index 31c3ad6c..7e79abdc 100644 --- a/plugins/omemo/src/file_transfer/file_encryptor.vala +++ b/plugins/omemo/src/file_transfer/file_encryptor.vala @@ -20,13 +20,15 @@ public class OmemoFileEncryptor : Dino.FileEncryptor, Object { } public FileMeta encrypt_file(Conversation conversation, FileTransfer file_transfer) throws FileSendError { + const uint KEY_SIZE = 32; + const uint IV_SIZE = 12; var omemo_http_file_meta = new OmemoHttpFileMeta(); try { //Create a key and use it to encrypt the file - uint8[] iv = new uint8[16]; + uint8[] iv = new uint8[IV_SIZE]; Plugin.get_context().randomize(iv); - uint8[] key = new uint8[32]; + uint8[] key = new uint8[KEY_SIZE]; Plugin.get_context().randomize(key); SymmetricCipher cipher = new SymmetricCipher("AES-GCM"); -- cgit v1.2.3-70-g09d2