简体   繁体   English

如何从借记卡/信用卡中获取卡号和有效期?

[英]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). 我有一个读卡器,可以读取带有Android芯片的卡(它通过USB连接)。 I can connect to card reader and power on card itself. 我可以连接到读卡器并打开卡本身的电源。 But I cannot understand reponse when I send APDU command. 但是我发送APDU命令时无法理解响应。 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. 我发现apdu命令后的6117响应显示命令已成功执行(61),并且有17个字节的响应可用。 So we need to send second apdu command to get that response 所以我们需要发送第二个apdu命令来获得该响应

00C0000017 - here 17 is number of bytes we expect and now in response we get information we needed. 00C0000017-这里的17是我们期望的字节数,现在作为响应,我们获得了所需的信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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