Esempio n. 1
0
        private void RegisterToServer(Fido2RegistrationResponse fido2RegistrationResponse)
        {
            string Tag = "RegisterToServer";

            if (!fido2RegistrationResponse.IsSuccess)
            {
                log.Error(Tag, GetString(Resource.String.reg_fail), fido2RegistrationResponse);
                return;
            }
            IFidoServer fidoServer = new FidoServerSimulator();

            if (fidoServer == null)
            {
                log.Error(Tag, GetString(Resource.String.connect_server_err));
                return;
            }

            ServerAttestationResultRequest request = ServerUtils.ConvertToServerAttestationResultRequest(fido2RegistrationResponse.AuthenticatorAttestationResponse);

            ServerResponse response = fidoServer.GetAttestationResult(request);

            if (!ServerStatus.Ok.Equals(response.GetStatus()))
            {
                log.Error(Tag, GetString(Resource.String.reg_fail) + response.GetErrorMessage());
                return;
            }
            GetRegInfo(fidoServer);
            log.Info(Tag, GetString(Resource.String.reg_success));
        }
Esempio n. 2
0
        private void OnClickDeregistration(object sender, EventArgs e)
        {
            string      Tag        = "OnClickDeregistration";
            IFidoServer fidoServer = new FidoServerSimulator();

            if (fidoServer == null)
            {
                log.Error(Tag, GetString(Resource.String.connect_server_err));
                return;
            }
            string userName = UserName;

            if (userName == null)
            {
                return;
            }
            ServerRegDeleteRequest request = new ServerRegDeleteRequest();

            request.Username = userName;

            ServerResponse response = fidoServer.Delete(request);

            if (!ServerStatus.Ok.Equals(response.GetStatus()))
            {
                log.Error(Tag, GetString(Resource.String.delete_register_info_fail) + response.GetErrorMessage());
                return;
            }
            log.Error(Tag, GetString(Resource.String.delete_register_info_success));
        }