diff --git a/mtkclient/Library/DA/xflash/xflash_lib.py b/mtkclient/Library/DA/xflash/xflash_lib.py index d8a1ed9..b7a28b8 100755 --- a/mtkclient/Library/DA/xflash/xflash_lib.py +++ b/mtkclient/Library/DA/xflash/xflash_lib.py @@ -8,6 +8,8 @@ import sys from binascii import hexlify from struct import pack, unpack +from Cryptodome.Util.number import long_to_bytes + from mtkclient.Library.Auth.sla import generate_da_sla_signature from mtkclient.Library.DA.xflash.xflash_flash_param import NandExtension from mtkclient.Library.DA.xflash.xflash_param import Cmd, ChecksumAlgorithm, FtSystemOSE, DataType @@ -1142,7 +1144,7 @@ class DAXFlash(metaclass=LogBase): rsakey = None from mtkclient.Library.Auth.sla_keys import da_sla_keys for key in da_sla_keys: - if da2.find(bytes.fromhex(key.n)) != -1: + if da2.find(long_to_bytes(key.n)) != -1: rsakey = key break if rsakey is None: diff --git a/mtkclient/Library/DA/xml/xml_lib.py b/mtkclient/Library/DA/xml/xml_lib.py index b4f34c1..ad399aa 100755 --- a/mtkclient/Library/DA/xml/xml_lib.py +++ b/mtkclient/Library/DA/xml/xml_lib.py @@ -7,6 +7,7 @@ from struct import pack, unpack from queue import Queue from threading import Thread +from Cryptodome.Util.number import long_to_bytes from Cryptodome.Cipher import PKCS1_OAEP from Cryptodome.Hash import SHA256 from Cryptodome.PublicKey import RSA @@ -624,7 +625,7 @@ class DAXML(metaclass=LogBase): from mtkclient.Library.Auth.sla_keys import da_sla_keys, SlaKey for key in da_sla_keys: if isinstance(key, SlaKey): - if da2.find(bytes.fromhex(key.n)) != -1: + if da2.find(long_to_bytes(key.n)) != -1: rsakey = key if rsakey is None: print("No valid sla key found, using dummy auth ....")