mirror of
https://github.com/aljazceru/python-teos.git
synced 2025-12-17 14:14:22 +01:00
Removes unnecessary encoding when unhexlifying
binascii.unhexlify(x) is equal to binascii.unhexlify(x.encode())
This commit is contained in:
@@ -132,7 +132,7 @@ class Cryptographer:
|
||||
|
||||
# Decrypt
|
||||
cipher = ChaCha20Poly1305(sk)
|
||||
data = unhexlify(encrypted_blob.data.encode())
|
||||
data = unhexlify(encrypted_blob.data)
|
||||
|
||||
try:
|
||||
blob = cipher.decrypt(nonce=nonce, data=data, associated_data=None)
|
||||
@@ -278,7 +278,7 @@ class Cryptographer:
|
||||
return False
|
||||
|
||||
if isinstance(signature, str):
|
||||
signature = unhexlify(signature.encode("utf-8"))
|
||||
signature = unhexlify(signature)
|
||||
|
||||
try:
|
||||
pk.verify(signature, message, ec.ECDSA(hashes.SHA256()))
|
||||
|
||||
Reference in New Issue
Block a user