From 39b66b51d64a0fbfbcbca8244cf0a732f58063d2 Mon Sep 17 00:00:00 2001 From: Dan <14043624+delivrance@users.noreply.github.com> Date: Sat, 16 Jun 2018 22:05:54 +0200 Subject: [PATCH] Remove salt assertion --- pyrogram/crypto/mtproto.py | 5 ++--- pyrogram/session/session.py | 1 - 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/pyrogram/crypto/mtproto.py b/pyrogram/crypto/mtproto.py index d42caf7c..10839126 100644 --- a/pyrogram/crypto/mtproto.py +++ b/pyrogram/crypto/mtproto.py @@ -40,14 +40,13 @@ class MTProto: return auth_key_id + msg_key + AES.ige256_encrypt(data + padding, aes_key, aes_iv) @staticmethod - def unpack(b: BytesIO, salt: int, session_id: bytes, auth_key: bytes, auth_key_id: bytes) -> Message: + def unpack(b: BytesIO, session_id: bytes, auth_key: bytes, auth_key_id: bytes) -> Message: assert b.read(8) == auth_key_id, b.getvalue() msg_key = b.read(16) aes_key, aes_iv = KDF(auth_key, msg_key, False) data = BytesIO(AES.ige256_decrypt(b.read(), aes_key, aes_iv)) - - assert data.read(8) == Long(salt) or Long(salt) == Long(MTProto.INITIAL_SALT) + data.read(8) # https://core.telegram.org/mtproto/security_guidelines#checking-session-id assert data.read(8) == session_id diff --git a/pyrogram/session/session.py b/pyrogram/session/session.py index 993ad2fa..c3dec02e 100644 --- a/pyrogram/session/session.py +++ b/pyrogram/session/session.py @@ -219,7 +219,6 @@ class Session: try: data = MTProto.unpack( BytesIO(packet), - self.current_salt.salt, self.session_id, self.auth_key, self.auth_key_id