简体   繁体   中英

How to get card number and expiration date from debit/credit card?

I have a card reader to read cards with chip for android (it connects via usb). I can connect to card reader and power on card itself. But I cannot understand reponse when I send APDU command. Here is my code.

String command = "00A404000E315041592E5359532E4444463031";
byte[] commandByte = apdu.s2ba(command);
byte[] prevByte = new byte[30];
int[] prevLen = new int[1];
prevLen[0] = 30;
int status = reader.SCardTransmit(commandByte, commandByte.length, prevByte, prevLen);
Log.i("ab", Integer.toString(status)+"----"+apdu.ba2s(prevByte)); 

I am getting response

09-02 23:30:19.648  25744-25744/com.nnadir.scanertest4 I/ab﹕ 0----30: 611700000000000000000000000000000000000000000000000000000000

but it must be something like this

6F 1A 84 0E 31 50 41 59 2E 53 59 53 2E 44 44 46 30 31 A5 08 88 01 01 5F 2D 02 65 6E

I am following this guide

I found that 6117 in response after apdu command shows that command was succesfull (61) and 17 bytes response available. So we need to send second apdu command to get that response

00C0000017 - here 17 is number of bytes we expect and now in response we get information we needed.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM