Esempio n. 1
0
 def test_correct_key_length(self):
     service = AESEncryption()
     service.configure()
     key = service._correct_key_length('*' * 10)
     self.assertEqual(len(key), AES.block_size)
     key = service._correct_key_length('*' * 20)
     self.assertEqual(len(key), AES.block_size)
     key = service._correct_key_length('*'*16)
     self.assertEqual(len(key), AES.block_size)
Esempio n. 2
0
 def test_correct_key_length(self):
     service = AESEncryption()
     service.configure()
     key = service._correct_key_length('*' * 10)
     self.assertEqual(len(key), AES.block_size)
     key = service._correct_key_length('*' * 20)
     self.assertEqual(len(key), AES.block_size)
     key = service._correct_key_length('*'*16)
     self.assertEqual(len(key), AES.block_size)
Esempio n. 3
0
 def test_check_sum_length(self):
     service = AESEncryption()
     service.configure()
     self.assertEqual(service.check_sum_length(), 4)
     service.configure(use_checksum=False)
     self.assertEqual(service.check_sum_length(), 0)
Esempio n. 4
0
 def test_is_encrypted(self):
     service = AESEncryption()
     service.configure()
     self.assertTrue(service.is_encrypted(b'KN+p\x80\xac\xe23IX', '123456', b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'))
Esempio n. 5
0
 def test_decrypt(self):
     service = AESEncryption()
     service.configure()
     self.assertEqual(b'secret', service.decrypt(b'KN+p\x80\xac\xe23IX', '123456',b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'))
Esempio n. 6
0
 def test_check_sum_length(self):
     service = AESEncryption()
     service.configure()
     self.assertEqual(service.check_sum_length(), 4)
     service.configure(use_checksum=False)
     self.assertEqual(service.check_sum_length(), 0)
Esempio n. 7
0
 def test_is_encrypted(self):
     service = AESEncryption()
     service.configure()
     self.assertTrue(service.is_encrypted('KN+p\x80\xac\xe23IX', '123456'))
Esempio n. 8
0
 def test_decrypt(self):
     service = AESEncryption()
     service.configure()
     self.assertEqual('secret', service.decrypt('KN+p\x80\xac\xe23IX', '123456'))