1
0
mirror of https://github.com/mjg59/python-broadlink.git synced 2024-11-10 18:00:12 +01:00

validate the authorization

This commit is contained in:
Daniel Høyer Iversen 2016-12-26 20:02:04 +01:00 committed by GitHub
parent b30fc0d1c1
commit 39e170c9e0

View File

@ -179,8 +179,16 @@ class device:
aes = AES.new(bytes(self.key), AES.MODE_CBC, bytes(self.iv))
payload = aes.decrypt(bytes(enc_payload))
if not payload:
return False
key = payload[0x04:0x14]
if len(key) % 16 != 0:
return False
self.id = payload[0x00:0x04]
self.key = payload[0x04:0x14]
self.key = key
return True
def get_type(self):
return self.type