Esempio n. 1
0
 def test_encrypt_and_decrypt(self):
     key_hex = utils.gen_aes_key_hex()
     content = json.dumps({'command': 'test'})
     cipher_string = utils.json_encrypt(key_hex, content)
     after = utils.json_decrypt(key_hex, cipher_string)
     self.assertEqual(after, content, 'test encrypt and decrypt fail')
Esempio n. 2
0
 def test_encrypt_and_decrypt(self):
     key_hex = utils.gen_aes_key_hex()
     content = json.dumps({'command': 'test'})
     cipher_string = utils.json_encrypt(key_hex, content)
     after = utils.json_decrypt(key_hex, cipher_string)
     self.assertEqual(after, content, 'test encrypt and decrypt fail')
Esempio n. 3
0
 def test_gen_aes_key(self):
     self.assertEqual(len(utils.gen_aes_key_hex()), 32,
                      'test gen command bytes array fail, the length is %d' % len(utils.gen_aes_key_hex()))
Esempio n. 4
0
 def test_gen_aes_key(self):
     self.assertEqual(
         len(utils.gen_aes_key_hex()), 32,
         'test gen command bytes array fail, the length is %d' %
         len(utils.gen_aes_key_hex()))