def test_key_serialization(self): tmpdir = tempfile.mkdtemp() try: filename = os.path.join(tmpdir, '.keyinfo') crypto.write_keyinfo(self.keyinfo, filename) keyinfo2 = crypto.read_keyinfo(filename) for name, keydata in self.keyinfo.items(): self.assertEqual(keydata, keyinfo2[name]) finally: shutil.rmtree(tmpdir)
def test_keyfile(self): keyinfo = crypto.generate_keyinfo(Client.KEY_SCHEMA) tmpdir = tempfile.mkdtemp() try: filename = os.path.join(tmpdir, '.keyinfo') crypto.write_keyinfo(keyinfo, filename) client = Client(filename) ptxt = b"test" ctxt = client.encrypt(ptxt) self.assertEqual(ptxt, client.decrypt(ctxt)) finally: shutil.rmtree(tmpdir)
def keygen(context, filename): """Generate client keys.""" keyinfo = crypto.generate_keyinfo(EDBClient.KEY_SCHEMA) crypto.write_keyinfo(keyinfo, filename) print('Created keyfile at {}'.format(os.path.abspath(filename)))
def keygen(context, filename): """Generate client keys.""" keyinfo = crypto.generate_keyinfo(EDBClient.KEY_SCHEMA) crypto.write_keyinfo(keyinfo, filename) print("Created keyfile at {}".format(os.path.abspath(filename)))