From 45091c158d956ebb6c23acfe4dcb1f147df55d4a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damir=20Jeli=C4=87?= Date: Wed, 23 Jan 2019 17:49:42 +0100 Subject: python: Turn the signature buffer into a bytearray. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is a workaround for a bug where signature verification would overwrite the variable holding the signature. This only happens on python2. Signed-off-by: Damir Jelić --- python/tests/account_test.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'python/tests') diff --git a/python/tests/account_test.py b/python/tests/account_test.py index 4fef72c..7ee6d2b 100644 --- a/python/tests/account_test.py +++ b/python/tests/account_test.py @@ -98,3 +98,19 @@ class TestClass(object): with pytest.raises(OlmVerifyError): ed25519_verify(signing_key, message, signature) + + @given(text()) + def test_signature_verification_twice(self, message): + alice = Account() + + signature = alice.sign(message) + signing_key = alice.identity_keys["ed25519"] + + assert signature + assert signing_key + + ed25519_verify(signing_key, message, signature) + assert signature == alice.sign(message) + + ed25519_verify(signing_key, message, signature) + assert signature == alice.sign(message) -- cgit v1.2.3