diff --git a/pisa/block_processor.py b/pisa/block_processor.py index 062d938..419e26f 100644 --- a/pisa/block_processor.py +++ b/pisa/block_processor.py @@ -64,8 +64,7 @@ class BlockProcessor: for uuid in locator_uuid_map[locator]: try: # ToDo: #20-test-tx-decrypting-edge-cases - justice_rawtx = appointments[uuid].encrypted_blob.decrypt(binascii.unhexlify(dispute_txid)) - justice_rawtx = binascii.hexlify(justice_rawtx).decode() + justice_rawtx = appointments[uuid].encrypted_blob.decrypt(dispute_txid) justice_txid = bitcoin_cli.decoderawtransaction(justice_rawtx).get('txid') matches.append((locator, uuid, dispute_txid, justice_txid, justice_rawtx)) diff --git a/pisa/encrypted_blob.py b/pisa/encrypted_blob.py index 7e7d2bb..63f6e64 100644 --- a/pisa/encrypted_blob.py +++ b/pisa/encrypted_blob.py @@ -11,6 +11,7 @@ class EncryptedBlob: def decrypt(self, key): # master_key = H(tx_id | tx_id) + key = unhexlify(key) master_key = sha256(key + key).digest() # The 16 MSB of the master key will serve as the AES GCM 128 secret key. The 16 LSB will serve as the IV. @@ -27,5 +28,6 @@ class EncryptedBlob: aesgcm = AESGCM(sk) data = unhexlify(self.data.encode()) raw_tx = aesgcm.decrypt(nonce=nonce, data=data, associated_data=None) + hex_raw_tx = hexlify(raw_tx).decode('utf8') - return raw_tx + return hex_raw_tx