1

enter image description here C# I tried calling the smart card and choosing its type, but all my options were returned with an error called E600 I tried to choose the card type from the class and the instructions and it did not help, is there any explanation? What's the solution Thanks anyway

private void bConnect_Click_1(object sender, EventArgs e)
    {
         int indx;
         string tmpStr;

         if (this.ConnActive == true)
        {
            DisplayOut(0, 0, "Connection is already active", "MCU");
            return;
        }

         //' 1. Connect to reader using SCARD_SHARE_DIRECT
         retcode = ModWinsCard64.SCardConnect(G_hContext, cbReader.Text, ModWinsCard64.SCARD_SHARE_SHARED, ModWinsCard64.SCARD_PROTOCOL_T1 | ModWinsCard64.SCARD_PROTOCOL_T0, ref hCard, ref ActiveProtocol);

         if (retcode != ModWinsCard64.SCARD_S_SUCCESS)
         {
             lstOutput.Items.Add("Connection Error");
             DisplayOut(1, retcode, "", "MCU");
             ConnActive = false;
             return;
         }
         else
         {
             DisplayOut(0, 0, "Successful connection to " + cbReader.Text, "MCU");

         }
         lstOutput.SelectedIndex = lstOutput.Items.Count - 1;
         ClearBuffers();

         ClearBuffers();
         //Select CardType
         SendBuff[0] = 0xFF;
         SendBuff[1] = 0xA4;
         SendBuff[2] = 0x00;
         SendBuff[3] = 0x00;
         SendBuff[4] = 0x01;
         SendBuff[5] = 0x05;

         SendBuffLen = 6;
         RecvBuffLen = 255;

        tmpStr = "";
        for (indx = 0; indx <= SendBuffLen - 1; indx++)
        {
            tmpStr = tmpStr + string.Format("{0:x2}", (SendBuff[indx])).ToUpper() + " ";
        }
        retcode = this.SendAPDUandDisplay(2, tmpStr);
        if (retcode != ModWinsCard64.SCARD_S_SUCCESS)
        {
            return;
        }

        ConnActive = true;

        fFunction.Enabled = true;
        ClearFields(); 
        tHiAdd.Focus();
        bConnect.Enabled = false;
    }

new erorr !!

En.Mahmoud
  • 11
  • 4
  • There are lots of reasons you cannot unlock a smart card. The driver on the PC may not be correct, you are using the wrong size addressing/data (8, 16,32 bit). I usually recommend unlocking the card in windows once a card is unlocked it will stay unlocked until the PC is shutoff. Once the card is unlocked than in you c# try reading a card to determine if you are using the correct addressing and data size. Then try writing card. Finally get code working to unlock card in c#. – jdweng May 31 '20 at 11:40
  • You seem to format the APDU as printable hex characters, where you should use plain bytes. – guidot May 31 '20 at 16:35
  • I solved that problem, but I found other sites that I try to write on and read that do not respond – En.Mahmoud Jun 01 '20 at 10:39
  • erorr name (A communications error with the smart card has been detected. Retry the operation) – En.Mahmoud Jun 01 '20 at 10:41

0 Answers0