From f20a1a82240209a8cddfd713708b1b5154aa9eac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maxime=20=E2=80=9Cpep=E2=80=9D=20Buquet?= Date: Mon, 19 Nov 2018 00:22:50 +0100 Subject: [PATCH] xep_0384: b64decode message elements when decrypting MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Maxime “pep” Buquet --- plugin.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/plugin.py b/plugin.py index ee08eed..6eb225e 100644 --- a/plugin.py +++ b/plugin.py @@ -44,7 +44,7 @@ def b64enc(data): def b64dec(data): - return base64.b64decode(data.decode('ASCII')) + return base64.b64decode(data) # XXX: This should probably be moved in plugins/base.py? @@ -232,7 +232,7 @@ class XEP_0384(BasePlugin): def decrypt_message(self, msg): header = msg['omemo_encrypted']['header'] - payload = msg['omemo_encrypted']['payload'] + payload = b64dec(msg['omemo_encrypted']['payload']['value']) jid = msg['from'].bare sid = header['sid'] @@ -245,8 +245,8 @@ class XEP_0384(BasePlugin): key = Key(key) isPrekeyMessage = key['prekey'] in TRUE_VALUES - message = key['value'] - iv = header['iv'] + message = b64dec(key['value']) + iv = b64dec(header['iv']['value']) return self._omemo.decryptMessage( jid,