From ecadbc62ef8940a67d2ed3130c2f6356eb1022ad Mon Sep 17 00:00:00 2001 From: Sergi Delgado Segura Date: Wed, 9 Oct 2019 15:19:03 +0100 Subject: [PATCH] Adds _eq_ method to EncryptedBlob --- pisa/encrypted_blob.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pisa/encrypted_blob.py b/pisa/encrypted_blob.py index b81db3f..ffc3e38 100644 --- a/pisa/encrypted_blob.py +++ b/pisa/encrypted_blob.py @@ -5,12 +5,15 @@ from cryptography.hazmat.primitives.ciphers.aead import AESGCM 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. class EncryptedBlob: def __init__(self, data): self.data = data + def __eq__(self, other): + return isinstance(other, EncryptedBlob) and self.data == other.data + def decrypt(self, key): # master_key = H(tx_id | tx_id) key = unhexlify(key)