Example #1
0
 def test1(self):
     """Verify correctness of test vector"""
     for tv in self._testData:
         s2v = _S2V.new(t2b(tv[1]), tv[3])
         for s in tv[0]:
             s2v.update(t2b(s))
         result = s2v.derive()
         self.assertEqual(result, t2b(tv[2]))
Example #2
0
 def test1(self):
     """Verify correctness of test vector"""
     for tv in self._testData:
         s2v = _S2V.new(t2b(tv[1]), tv[3])
         for s in tv[0]:
             s2v.update(t2b(s))
         result = s2v.derive()
         self.assertEqual(result, t2b(tv[2]))
Example #3
0
 def test2(self):
     """Verify that no more than 127(AES) and 63(TDES)
     components are accepted."""
     key = bchr(0)*16
     for module in (AES, DES3):
         s2v = _S2V.new(key, module)
         max_comps = module.block_size*8-1
         for i in range(max_comps):
             s2v.update(b("XX"))
         self.assertRaises(TypeError, s2v.update, b("YY"))
Example #4
0
 def test2(self):
     """Verify that no more than 127(AES) and 63(TDES)
     components are accepted."""
     key = bchr(0) * 8 + bchr(255) * 8
     for module in (AES, DES3):
         s2v = _S2V.new(key, module)
         max_comps = module.block_size*8-1
         for i in xrange(max_comps):
             s2v.update(b("XX"))
         self.assertRaises(TypeError, s2v.update, b("YY"))