Beispiel #1
0
        private async void ButtonGetAssertion_Click(object sender, RoutedEventArgs e)
        {
            addLog("<getAssertion>");

            var rpid      = this.textBoxRPID.Text;
            var challenge = System.Text.Encoding.ASCII.GetBytes("this is challenge");

            //var creid = g.FIDO2.Common.HexStringToBytes("99F946F5EAC7F8F9D56FF1F791626143DCBB9450AAA102F4EDBFF6D9913E44E9161B7AE113EFC482DA6C22A9037840757D8DA9922233BCB99F0473528E6DD7E8");
            byte[] creid = null;
            if (!string.IsNullOrEmpty(textBoxCreID.Text))
            {
                creid = g.FIDO2.Common.HexStringToBytes(textBoxCreID.Text);
            }

            var param = new g.FIDO2.CTAP.CTAPCommandGetAssertionParam(rpid, challenge, creid);

            param.Option_up = true;
            param.Option_uv = false;

            //Include the hmac-secret extension in the assertion
            if (this.checkBoxHmacSecret.IsChecked.HasValue && this.checkBoxHmacSecret.IsChecked.Value)
            {
                param.UseHmacExtension = true;
            }

            string pin = this.textBoxPIN.Text;

            var res = await con.GetAssertionAsync(param, pin);

            LogResponse(res.DeviceStatus, res.CTAPResponse);

            if (res?.CTAPResponse?.Assertion?.NumberOfCredentials > 0)
            {
                for (int intIc = 0; intIc < res.CTAPResponse.Assertion.NumberOfCredentials - 1; intIc++)
                {
                    var next = await con.GetNextAssertionAsync();

                    LogResponse(res.DeviceStatus, next.CTAPResponse);
                }
            }
        }