Esempio n. 1
0
        private void logResponse(CTAPauthenticator ctap, CTAPResponse res)
        {
            string msg = "<Command>\r\n" + ctap.payloadJson + "\r\n\r\n";

            msg = msg + "<Response>\r\n";
            msg = msg + string.Format($"Status=0x{res.Status:X2}\r\nMsg={res.StatusMsg}\r\n<ResponseData>\r\n");
            msg = msg + res.ResponseDataJson + "\r\n";
            log(msg);

            if (res.GetType() == typeof(CTAPResponseAssertion))
            {
                var ret = (CTAPResponseAssertion)res;
                log(string.Format($"User_Id={Encoding.ASCII.GetString(ret.User_Id)}"));
                log(string.Format($"User_Name={ret.User_Name}"));
                log(string.Format($"User_DisplayName={ret.User_DisplayName}"));
                log(string.Format($"Flags_AttestedCredentialDataIncluded={ret.Flags_AttestedCredentialDataIncluded}"));
                log(string.Format($"Flags_ExtensionDataIncluded={ret.Flags_ExtensionDataIncluded}"));
                log(string.Format($"Flags_UserPresentResult={ret.Flags_UserPresentResult}"));
                log(string.Format($"Flags_UserVerifiedResult={ret.Flags_UserVerifiedResult}"));
                log(string.Format($"NumberOfCredentials={ret.NumberOfCredentials}"));
            }
        }
Esempio n. 2
0
        protected override async Task <(DeviceStatus devSt, CTAPResponse ctapRes)> sendCommandandResponseAsync(CTAPCommand cmd, CTAPResponse res)
        {
            try {
                // 送信コマンドを作成(byte[]) | Create send command
                var payload = cmd.CreatePayload();

                // 送信して、応答受信(byte[]) | Send and receive response
                var sender = new CTAPHIDSender();
                sender.KeepAlive += this.KeepAlive;
                var response = await sender.SendCommandandResponseAsync(hidParams, payload, ReceiveResponseTimeoutmillisecond);

                // 応答をパース | Parse response
                if (response.ctapRes != null)
                {
                    res.Parse(response.ctapRes);
                }
                res.SendPayloadJson = cmd.PayloadJson;

                return(response.devSt, res);
            } catch (Exception ex) {
                Logger.Log($"Exception...{ex.Message})");
                return(DeviceStatus.Unknown, null);
            }
        }
Esempio n. 3
0
        protected override async Task <(DeviceStatus devSt, CTAPResponse ctapRes)> sendCommandandResponseAsync(CTAPCommand cmd, CTAPResponse res)
        {
            try {
                // 送信コマンドを作成(byte[]) | Create send command
                var payload = cmd.CreatePayload();

                // 送信して、応答受信(byte[]) | Send and receive response (byte [])
                var sender   = new CTAPBLESender(PacketSizeByte, receiver);
                var response = await sender.SendCommandandResponseAsync(characteristic_Send, payload, 10000);

                // 応答をパース | Parse response
                res.Parse(response.ctapRes);
                res.SendPayloadJson = cmd.PayloadJson;

                return(response.devSt, res);
            } catch (Exception ex) {
                Logger.Log($"Exception...{ex.Message})");
                return(DeviceStatus.Unknown, null);
            }
        }
Esempio n. 4
0
 public CommandInfo(CTAPauthenticator cmd, CTAPResponse res)
 {
     this.cmd = cmd;
     this.res = res;
 }