diff options
author | Marvin W <git@larma.de> | 2020-09-15 17:33:40 +0200 |
---|---|---|
committer | Marvin W <git@larma.de> | 2020-09-15 20:32:09 +0200 |
commit | 1956f63179c4f3ac3232cc4a2da8046565fad2a1 (patch) | |
tree | 474db2b99573a1d24d197a77064dff723bcd9774 /plugins | |
parent | cd5b639a826ccafe5741a51f10cc8ca76ebfdd14 (diff) | |
download | dino-1956f63179c4f3ac3232cc4a2da8046565fad2a1.tar.gz dino-1956f63179c4f3ac3232cc4a2da8046565fad2a1.zip |
Set key size for omemo http file transfers to 256 bits
Fixes #909
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/omemo/src/file_transfer/file_decryptor.vala | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/plugins/omemo/src/file_transfer/file_decryptor.vala b/plugins/omemo/src/file_transfer/file_decryptor.vala index fedb9397..97d61899 100644 --- a/plugins/omemo/src/file_transfer/file_decryptor.vala +++ b/plugins/omemo/src/file_transfer/file_decryptor.vala @@ -44,6 +44,7 @@ public class OmemoFileDecryptor : FileDecryptor, Object { } public async InputStream decrypt_file(InputStream encrypted_stream, Conversation conversation, FileTransfer file_transfer, FileReceiveData receive_data) throws FileReceiveError { + const uint KEY_SIZE = 32; try { OmemoHttpFileReceiveData? omemo_http_receive_data = receive_data as OmemoHttpFileReceiveData; if (omemo_http_receive_data == null) assert(false); @@ -52,8 +53,8 @@ public class OmemoFileDecryptor : FileDecryptor, Object { MatchInfo match_info; this.url_regex.match(omemo_http_receive_data.original_url, 0, out match_info); uint8[] iv_and_key = hex_to_bin(match_info.fetch(2).up()); - uint8[] iv = iv_and_key[0:iv_and_key.length-16]; - uint8[] key = iv_and_key[iv_and_key.length-16:iv_and_key.length]; + uint8[] iv = iv_and_key[0:iv_and_key.length-KEY_SIZE]; + uint8[] key = iv_and_key[iv_and_key.length-KEY_SIZE:iv_and_key.length]; file_transfer.encryption = Encryption.OMEMO; debug("Decrypting file %s from %s", file_transfer.file_name, file_transfer.server_file_name); |