mirror of
https://github.com/aljazceru/python-teos.git
synced 2025-12-18 06:34:19 +01:00
Makes sure that blobs to be decrypred are even-length
This commit is contained in:
@@ -17,6 +17,12 @@ class Cryptographer:
|
|||||||
if rtype not in ["hex", "bytes"]:
|
if rtype not in ["hex", "bytes"]:
|
||||||
raise ValueError("Wrong return type. Return type must be 'hex' or 'bytes'")
|
raise ValueError("Wrong return type. Return type must be 'hex' or 'bytes'")
|
||||||
|
|
||||||
|
if len(encrypted_blob.data) % 2:
|
||||||
|
logger.info(
|
||||||
|
"Incorrect (Odd-length) value to be decrypted.", encrypted_blob=encrypted_blob.data, dispute_txid=key
|
||||||
|
)
|
||||||
|
return None
|
||||||
|
|
||||||
# master_key = H(tx_id | tx_id)
|
# master_key = H(tx_id | tx_id)
|
||||||
key = unhexlify(key)
|
key = unhexlify(key)
|
||||||
master_key = sha256(key + key).digest()
|
master_key = sha256(key + key).digest()
|
||||||
|
|||||||
Reference in New Issue
Block a user