protected static string getCommandName(CTAPCommandType commandType) { string name = ""; switch (commandType) { case CTAPCommandType.authenticatorMakeCredential: name = "authenticatorMakeCredential"; break; case CTAPCommandType.authenticatorGetAssertion: name = "authenticatorGetAssertion"; break; case CTAPCommandType.authenticatorGetInfo: name = "authenticatorGetInfo"; break; case CTAPCommandType.authenticatorClientPIN: name = "authenticatorClientPIN"; break; case CTAPCommandType.authenticatorGetNextAssertion: name = "authenticatorGetNextAssertion"; break; } return(name); }
protected byte[] create(CTAPCommandType commandType, CBORObject payload) { byte[] send = null; PayloadJson = string.Format($"[0x{(byte)commandType:X2}]({getCommandName(commandType)})"); if (payload != null) { PayloadJson = PayloadJson + payload.ToJSONString(); Logger.Log($"Send: {PayloadJson}"); var payloadb = payload.EncodeToBytes(); send = new byte[] { (byte)commandType }.Concat(payloadb).ToArray(); } else { send = new byte[] { (byte)commandType }; } return(send); }