diff options
author | Marvin W <git@larma.de> | 2020-09-14 21:56:58 +0200 |
---|---|---|
committer | Marvin W <git@larma.de> | 2020-09-14 22:04:06 +0200 |
commit | cd5b639a826ccafe5741a51f10cc8ca76ebfdd14 (patch) | |
tree | f39146eb751f67e99942770c67cf06ca4a912243 /plugins/omemo/src/file_transfer/file_encryptor.vala | |
parent | f6943a4c82ed39b8d6ae866855198596a51dade4 (diff) | |
download | dino-cd5b639a826ccafe5741a51f10cc8ca76ebfdd14.tar.gz dino-cd5b639a826ccafe5741a51f10cc8ca76ebfdd14.zip |
Send OMEMO-encrypted messages and files using 12 byte IV
Diffstat (limited to 'plugins/omemo/src/file_transfer/file_encryptor.vala')
-rw-r--r-- | plugins/omemo/src/file_transfer/file_encryptor.vala | 6 |
1 files changed, 4 insertions, 2 deletions
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"); |