]> wagner.pp.ru Git - oss/ctypescrypto.git/commitdiff
Ensured that encrypt and decrypt in test_ofb_noiv use physically different keys
authorVictor Wagner <wagner@atlas-card.ru>
Fri, 6 Jun 2014 13:59:55 +0000 (17:59 +0400)
committerVictor Wagner <wagner@atlas-card.ru>
Fri, 6 Jun 2014 13:59:55 +0000 (17:59 +0400)
tests/testcipher.py

index 052193c2143062046ed8ae615b03874486622523..ae74d412dd44c2befb829ef885c6457750502003 100644 (file)
@@ -56,12 +56,15 @@ class TestEncryptDecrypt(unittest.TestCase):
 
        def test_ofb_noiv(self):
                data="sdfdsddfxx"
-               key='abcdabcd'
-               c=cipher.new("AES-256-OFB",key)
+               encryptkey='abcdabcd'*4
+               decryptkey=encryptkey[0:5]+encryptkey[5:]
+
+
+               c=cipher.new("AES-256-OFB",encryptkey)
                enc=c.update(data)+c.finish()
                # See if padding is added by default
                self.assertEqual(len(enc),len(data))
-               d=cipher.new("AES-256-OFB",key,encrypt=False)
+               d=cipher.new("AES-256-OFB",decryptkey)
                dec=d.update(enc)+d.finish()
                self.assertEqual(data,dec)
 if __name__ == '__main__':