Question

below is the function from the winscard API

[DllImport("winscard.dll")]        
public  static extern int SCardTransmit (
                                          int hCard, 
                                          ref SCARD_IO_REQUEST pioSendRequest, 
                                          ref byte SendBuff, 
                                          int SendBuffLen, 
                                          ref SCARD_IO_REQUEST pioRecvRequest, 
                                          ref byte RecvBuff, 
                                          ref int RecvBuffLen);

but the third parameter accepts the APDU command that is similar to something like FF B2 A4 03 0E
So am wondering how to pass that data in byte for to that parameter if i already have it in string form.

I know this could be a replication but i have failed to find a solution. Any links or other info will be so helpful.

Thanks in advance.

Was it helpful?

Solution

That's pretty simple. What you have there is a hexadecimal string, so you need a hexadecimal encoder/decoder package to convert these kind of strings to/from a byte array.

Note that the given hexadecimal string does not look like any APDU that I've heard of.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top