Remove salt assertion
This commit is contained in:
parent
d1d789bf20
commit
39b66b51d6
@ -40,14 +40,13 @@ class MTProto:
|
|||||||
return auth_key_id + msg_key + AES.ige256_encrypt(data + padding, aes_key, aes_iv)
|
return auth_key_id + msg_key + AES.ige256_encrypt(data + padding, aes_key, aes_iv)
|
||||||
|
|
||||||
@staticmethod
|
@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()
|
assert b.read(8) == auth_key_id, b.getvalue()
|
||||||
|
|
||||||
msg_key = b.read(16)
|
msg_key = b.read(16)
|
||||||
aes_key, aes_iv = KDF(auth_key, msg_key, False)
|
aes_key, aes_iv = KDF(auth_key, msg_key, False)
|
||||||
data = BytesIO(AES.ige256_decrypt(b.read(), aes_key, aes_iv))
|
data = BytesIO(AES.ige256_decrypt(b.read(), aes_key, aes_iv))
|
||||||
|
data.read(8)
|
||||||
assert data.read(8) == Long(salt) or Long(salt) == Long(MTProto.INITIAL_SALT)
|
|
||||||
|
|
||||||
# https://core.telegram.org/mtproto/security_guidelines#checking-session-id
|
# https://core.telegram.org/mtproto/security_guidelines#checking-session-id
|
||||||
assert data.read(8) == session_id
|
assert data.read(8) == session_id
|
||||||
|
@ -219,7 +219,6 @@ class Session:
|
|||||||
try:
|
try:
|
||||||
data = MTProto.unpack(
|
data = MTProto.unpack(
|
||||||
BytesIO(packet),
|
BytesIO(packet),
|
||||||
self.current_salt.salt,
|
|
||||||
self.session_id,
|
self.session_id,
|
||||||
self.auth_key,
|
self.auth_key,
|
||||||
self.auth_key_id
|
self.auth_key_id
|
||||||
|
Loading…
Reference in New Issue
Block a user