def set_security_module(): """ Set the password for the security module """ password = getParam(request.all_data, "password", required) is_ready = set_hsm_password(password) res = {"is_ready": is_ready} g.audit_object.log({'success': res}) return send_result(res)
def test_01_set_password(self): with self.pkcs11: hsm = init_hsm() self.assertIsInstance(hsm, AESHardwareSecurityModule) with self.assertRaises(HSMException): get_hsm() self.assertIs(get_hsm(require_ready=False), hsm) ready = set_hsm_password("test123!") self.assertTrue(ready) self.assertIs(hsm, init_hsm()) self.assertIs(get_hsm(), hsm)