def test_symmetric(self, data):
     data = str(data)
     sk2 = AutoSymKey(key_iv_code=self.key_iv_code)
     self.assertEqual(data, sk2.decrypt(self.key.encrypt(data)))
     self.assertEqual(data, sk2.decrypt_hex(self.key.encrypt_hex(data)))
     self.assertEqual(data,
                      sk2.decrypt_base64(self.key.encrypt_base64(data)))
示例#2
0
 def test_symmetric(self, data):
     data = str(data)
     sk2 = AutoSymKey(key_iv_code=self.key_iv_code)
     self.assertEqual(data, sk2.decrypt(self.key.encrypt(data)))
     self.assertEqual(data, sk2.decrypt_hex(self.key.encrypt_hex(data)))
     self.assertEqual(data,
                      sk2.decrypt_base64(self.key.encrypt_base64(data)))
示例#3
0
class TestAutoSymKey(unittest.TestCase):
    def setUp(self):
        self.key = AutoSymKey()

    def test_auto_load(self):
        self.key.auto_load()
        self.assertTrue(self.key.cypher_name is None)
        self.assertTrue(self.key.key_str is None)
        try:
            key2 = AutoSymKey('bogus,bogus,bogus')
            assert False
        except ValueError:
            pass
class TestAutoSymKey(unittest.TestCase):

    def setUp(self):
        self.key = AutoSymKey()

    def test_auto_load(self):
        self.key.auto_load()
        self.assertTrue(self.key.cypher_name is None)
        self.assertTrue(self.key.key_str is None)
        try:
            key2 = AutoSymKey('bogus,bogus,bogus')
            assert False
        except ValueError:
            pass
示例#5
0
 def test_auto_load(self):
     self.key.auto_load()
     self.assertTrue(self.key.cypher_name is None)
     self.assertTrue(self.key.key_str is None)
     try:
         key2 = AutoSymKey('bogus,bogus,bogus')
         assert False
     except ValueError:
         pass
示例#6
0
 def setUp(self):
     self.key = AutoSymKey()
 def setUp(self):
     self.key = AutoSymKey()