private static void VerifyUser3Wbp(ISmartCardReader smartCardReader, byte firstPinByte, byte secondPinByte) { var threeWireBusProtocol = new Readers.AViatoR.Components.Synchronus3WBP(); byte newErrorCounter; Console.WriteLine("User Verification"); // Read Error Counter string command = threeWireBusProtocol.ReadErrorCounterApdu(); string response = smartCardReader.Transmit(command); string currentErrorCounter = response.Substring(4, 2); PrintData("Read Error Counter", command, response, $"0x{currentErrorCounter}"); // decrement counter switch (currentErrorCounter) { case "7F": newErrorCounter = 0x7E; break; case "7E": newErrorCounter = 0x7C; break; case "7C": newErrorCounter = 0x78; break; case "78": newErrorCounter = 0x70; break; case "70": newErrorCounter = 0x60; break; case "60": newErrorCounter = 0x40; break; case "40": newErrorCounter = 0x00; break; default: Console.WriteLine("Returned error counter is not correct or card is blocked"); return; } command = threeWireBusProtocol.WriteErrorCounterApdu(newErrorCounter); response = smartCardReader.Transmit(command); PrintData("Write new Error Counter", command, response, $"0x{newErrorCounter:X2}"); // Verify pin first byte command = threeWireBusProtocol.VerifyFirstPinByte(firstPinByte); response = smartCardReader.Transmit(command); PrintData("Verify first pin byte", command, response, $"{firstPinByte:X2}"); // Verify pin second byte command = threeWireBusProtocol.VerifySecondPinByte(secondPinByte); response = smartCardReader.Transmit(command); PrintData("Verify second pin byte", command, response, $"{secondPinByte:X2}"); // Reset Error Counter command = threeWireBusProtocol.ResetErrorCounterApdu(); response = smartCardReader.Transmit(command); PrintData("Reset Error Counter", command, response, ""); }