Hi everyone i've got another questions for you : )
I want to communicate smartcard with protocol t=1. i am using windows smartcard api (winscard.dll) and C#. i've got
SCardEstablishContext(), SCardListReaders(), SCardConnect(), SCardStatus(), SCardTransmit(), SCardDisconnect(), SCardReleaseContext() functions for transmitting data.
i want to select the master file (mf) with the below code
SCARD_IO_REQUEST sendreq,recvreq;
byte[] sendbuff = { 0x00, 0xA4, 0x00, 0x00, 0x02, 0x3F, 0x00 };
sendreq.protocol = SCARD_PROTOCOL_T1;
sendreq.pciLength = 8;
recvreq.protocol = SCARD_PROTOCOL_T1;
recvreq.pciLength = 8;
byte[] RecvBuff = new byte[258];
int recvbufflen = 2;
SCardTransmit(hCard, ref sendreq, ref sendbuff[0], sendbuff.Length, ref recvreq, ref RecvBuff[0], ref recvbufflen);
the response must be 9000 for the successful task but i receive 6A86 (invalid ins parameters).
my questions are:
1- Why am i receiving this response?
2- Do i have to change the protocol with pts command if yes why? (the card supports only t1)
3- the protocol t = 1 frame must be prologue field + information field + epilogue field. But i dont add the prologue and epilogue bytes to sendbuff. is it necessary to add them to sendbuff while using windows api?
Thanks..