diff options
author | Sybren A. St?vel <sybren@stuvel.eu> | 2011-07-10 13:23:34 +0200 |
---|---|---|
committer | Sybren A. St?vel <sybren@stuvel.eu> | 2011-07-10 13:23:34 +0200 |
commit | 11016f9b792c59f4f95c1efb379db5d5ad8c7786 (patch) | |
tree | e47a4b923a693b01600260db2e3c2b6fd5490d11 /tests | |
parent | b21277340477dc6cce400c1473de74230b0e3b46 (diff) | |
download | rsa-11016f9b792c59f4f95c1efb379db5d5ad8c7786.tar.gz |
Added test for randomness
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_pkcs1.py | 11 |
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' |