mirror of
https://github.com/aljazceru/python-teos.git
synced 2025-12-18 22:54:23 +01:00
Adds _eq_ method to EncryptedBlob
This commit is contained in:
@@ -5,12 +5,15 @@ from cryptography.hazmat.primitives.ciphers.aead import AESGCM
|
|||||||
from pisa import logging
|
from pisa import logging
|
||||||
|
|
||||||
|
|
||||||
# FIXME: EncryptedBlob is assuming AESGCM. A cipher field should be part of the object and the decryption should be
|
# FIXME: EncryptedBlob is assuming AES-128-GCM. A cipher field should be part of the object and the decryption should be
|
||||||
# performed depending on the cipher.
|
# performed depending on the cipher.
|
||||||
class EncryptedBlob:
|
class EncryptedBlob:
|
||||||
def __init__(self, data):
|
def __init__(self, data):
|
||||||
self.data = data
|
self.data = data
|
||||||
|
|
||||||
|
def __eq__(self, other):
|
||||||
|
return isinstance(other, EncryptedBlob) and self.data == other.data
|
||||||
|
|
||||||
def decrypt(self, key):
|
def decrypt(self, key):
|
||||||
# master_key = H(tx_id | tx_id)
|
# master_key = H(tx_id | tx_id)
|
||||||
key = unhexlify(key)
|
key = unhexlify(key)
|
||||||
|
|||||||
Reference in New Issue
Block a user