From 74a60a2e5b11c95798f1081949daf9aab0289853 Mon Sep 17 00:00:00 2001 From: Goffi Date: Tue, 18 Feb 2020 18:17:18 +0100 Subject: [PATCH] plugin aesgcm: use 12 bytes Initialisation Vector: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit SàT was using 16 bytes IV when sending files withr AES-GCM, due to ChatSecure being only compatible with that. Monal, an other iOS client is only compatible with 12 bytes IV, and ChatSecure has fixed its code to also handle 12 bytes IV, so there is not reason anymore to use 16 bytes, and SàT now uses 12 bytes. --- sat/plugins/plugin_sec_aesgcm.py | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/sat/plugins/plugin_sec_aesgcm.py b/sat/plugins/plugin_sec_aesgcm.py index e4171e07..0ea9c0e0 100644 --- a/sat/plugins/plugin_sec_aesgcm.py +++ b/sat/plugins/plugin_sec_aesgcm.py @@ -170,13 +170,7 @@ class AESGCM(object): if options.get('encryption') != C.ENC_AES_GCM: return True log.debug("encrypting file with AES-GCM") - # specification talks about 12 bytes IV, but in practice and for legacy reasons - # 16 bytes are used by most clients (and also in the specification example). - # It seems that some clients don't handle 12 bytes IV (apparently, - # that's the case for ChatSecure). - # So we have to follow the de-facto standard and use 16 bytes to be sure - # to be compatible with a maximum of clients. - iv = secrets.token_bytes(16) + iv = secrets.token_bytes(12) key = secrets.token_bytes(32) fragment = f'{iv.hex()}{key.hex()}' ori_url = parse.urlparse(slot.get)