summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tests/test_bigfile.py21
1 files changed, 20 insertions, 1 deletions
diff --git a/tests/test_bigfile.py b/tests/test_bigfile.py
index ffca5b0..30156a1 100644
--- a/tests/test_bigfile.py
+++ b/tests/test_bigfile.py
@@ -4,7 +4,7 @@ from StringIO import StringIO
import unittest
import rsa
-from rsa import bigfile, varblock
+from rsa import bigfile, varblock, pkcs1
class BigfileTest(unittest.TestCase):
@@ -35,3 +35,22 @@ class BigfileTest(unittest.TestCase):
varblocks = list(varblock.yield_varblocks(cryptfile))
self.assertEqual(2, len(varblocks))
+
+ def test_sign_verify_bigfile(self):
+
+ # Large enough to store MD5-sum and ASN.1 code for MD5
+ pub_key, priv_key = rsa.newkeys((34 + 11) * 8)
+
+ # Sign the file
+ msgfile = StringIO('123456Sybren')
+ signature = pkcs1.sign(msgfile, priv_key, 'MD5')
+
+ # Check the signature
+ msgfile.seek(0)
+ pkcs1.verify(msgfile, signature, pub_key)
+
+ # Alter the message, re-check
+ msgfile = StringIO('123456sybren')
+ self.assertRaises(pkcs1.VerificationError,
+ pkcs1.verify, msgfile, signature, pub_key)
+