summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/test_pkcs1.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/test_pkcs1.py b/tests/test_pkcs1.py
index 230e7f7..0d55d7b 100644
--- a/tests/test_pkcs1.py
+++ b/tests/test_pkcs1.py
@@ -34,6 +34,17 @@ class BinaryTest(unittest.TestCase):
self.assertRaises(ValueError, pkcs1.decrypt, encrypted, self.priv)
+ def test_randomness(self):
+ '''Encrypting the same message twice should result in different
+ cryptos.
+ '''
+
+ message = struct.pack('>IIII', 0, 0, 0, 1)
+ encrypted1 = pkcs1.encrypt(message, self.pub)
+ encrypted2 = pkcs1.encrypt(message, self.pub)
+
+ self.assertNotEqual(encrypted1, encrypted2)
+
# def test_sign_verify(self):
#
# message = struct.pack('>IIII', 0, 0, 0, 1) + 20 * '\x00'