CVS: crypto/test test_publickey.py,1.6,1.7

"A.M. Kuchling" <[email protected]> Fri, 04 Apr 2003 11:38:33 -0800
Newsgroups gmane.comp.python.cryptography.cvs
Message-ID <[email protected]>
Update of /cvsroot/pycrypto/crypto/test
In directory sc8-pr-cvs1:/tmp/cvs-serv24971

Modified Files:
	test_publickey.py 
Log Message:
Test maximum-sized plaintext

Index: test_publickey.py
===================================================================
RCS file: /cvsroot/pycrypto/crypto/test/test_publickey.py,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- test_publickey.py	3 Apr 2003 20:36:15 -0000	1.6
+++ test_publickey.py	4 Apr 2003 19:38:28 -0000	1.7
@@ -26,12 +26,16 @@
 
     def testkey (self, key, randfunc, verbose=0):
         plaintext="Hello"
+        # Generate maximum-size plaintext
+        maxplain = (key.size() // 8) * '\377'
 
         if key.can_encrypt():
             if verbose: print '  Encryption/decryption test'
             K=number.getPrime(10, randfunc)
             ciphertext=key.encrypt(plaintext, K)
             self.test_val('key.decrypt(ciphertext)', plaintext)
+            ciphertext=key.encrypt(maxplain, K)
+            self.test_val('key.decrypt(ciphertext)', maxplain)
 
         if key.can_sign():
             if verbose: print '  Signature test'



-------------------------------------------------------
This SF.net email is sponsored by: ValueWeb: 
Dedicated Hosting for just $79/mo with 500 GB of bandwidth! 
No other company gives more support or power for your dedicated server
http://click.atdmt.com/AFF/go/sdnxxaff00300020aff/direct/01/