From fd704137a88bc939155a104540421b41107c2531 Mon Sep 17 00:00:00 2001 From: Kevin F Date: Thu, 26 Jan 2023 15:03:49 -0600 Subject: [PATCH] Added anonymous decryption test for wot --- static-data/official-plugins/tor/bootstrap.txt | 1 - .../wot/test_decrypt_from_identity.py | 18 ++++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/static-data/official-plugins/tor/bootstrap.txt b/static-data/official-plugins/tor/bootstrap.txt index 47bf5e2c..e69de29b 100644 --- a/static-data/official-plugins/tor/bootstrap.txt +++ b/static-data/official-plugins/tor/bootstrap.txt @@ -1 +0,0 @@ -iub5tjg3iu23btf7depeohyefv3n52izqcomprrrn72hvlrnvp5fjlyd,diqljvlqppawyki3lo2emh3sibvhflmn7d736gqcr5m6obrnfn6cytyd \ No newline at end of file diff --git a/tests/default-plugin-tests/wot/test_decrypt_from_identity.py b/tests/default-plugin-tests/wot/test_decrypt_from_identity.py index a9ee2c3c..d8b1cc82 100644 --- a/tests/default-plugin-tests/wot/test_decrypt_from_identity.py +++ b/tests/default-plugin-tests/wot/test_decrypt_from_identity.py @@ -46,6 +46,24 @@ class TestDecryptFromIdentity(unittest.TestCase): decrypted = crypto.encryption.decrypt_from_identity(identity, their_identity, encrypted) self.assertIsInstance(decrypted, result.Ok) self.assertEqual(decrypted.value, test_message) + + def test_decrypt_from_identity_anonymously(self): + iden_priv_key = signing.SigningKey.generate() + iden_public = iden_priv_key.verify_key + identity = Identity(iden_priv_key, "us") + + their_priv_key = signing.SigningKey.generate() + their_public = their_priv_key.verify_key + their_identity = Identity(their_priv_key, "them") + + test_message = b"test message" + + encrypted = nacl.public.SealedBox(their_public.to_curve25519_public_key()).encrypt(test_message) + self.assertIsInstance(encrypted, bytes) + + decrypted = crypto.encryption.decrypt_from_identity_anonymously(their_identity, encrypted) + self.assertIsInstance(decrypted, result.Ok) + self.assertEqual(decrypted.value, test_message)