From 8c487e5c2ba2e46919625d427c69fc2139081c4e Mon Sep 17 00:00:00 2001 From: Sean Batzel Date: Tue, 25 Sep 2018 17:02:17 -0400 Subject: [PATCH] Determined that we're also failing to verify signatures in the test file - I may have to check in to that and see if there is a better crypt module. --- blockchain_message/src/blockchain.py | 3 --- blockchain_message/src/crypt.py | 1 - test/test_crypt.py | 2 +- 3 files changed, 1 insertion(+), 5 deletions(-) diff --git a/blockchain_message/src/blockchain.py b/blockchain_message/src/blockchain.py index 2980ebc..c47790a 100644 --- a/blockchain_message/src/blockchain.py +++ b/blockchain_message/src/blockchain.py @@ -57,9 +57,6 @@ def retrieve(self, user: Contact, last_message: int, contact_list: List[Contact] result = contract.functions.retrieve(int(user.address), last_message).call() - result = bytes(result, 'utf8') - result = result.decode('utf8') - messages = list() res_list = result.split('♠') diff --git a/blockchain_message/src/crypt.py b/blockchain_message/src/crypt.py index e51e6cd..ba7dff5 100644 --- a/blockchain_message/src/crypt.py +++ b/blockchain_message/src/crypt.py @@ -73,7 +73,6 @@ def verify(message: str, signature: str, sender: Contact): :param signature: The signature to verify. :param sender: The contact who the message claims to be sent by. """ - signature.replace("\\\\", "\\") m = bytes(bytes(message, 'latin-1').decode('latin-1'), 'latin-1') s = bytes(signature, 'latin-1') rsa.verify(m, s, rsa.PublicKey.load_pkcs1(sender.key)) diff --git a/test/test_crypt.py b/test/test_crypt.py index b6042f2..75bee9e 100644 --- a/test/test_crypt.py +++ b/test/test_crypt.py @@ -23,5 +23,5 @@ def test_verify(self): c = Crypt("other") con = Contact("00001", "other", "other@test.com") message = "This is a test." - signature = c.sign(message) + signature = str(c.sign(message)) c.verify(message, signature, con)