简体   繁体   English

APDU命令使用Samsung Galaxy S4从Visa Wave NFC签证中读取信用卡数据

[英]APDU command to read credit card data from visa Paywave NFC enabled card using Samsung Galaxy S4

  byte[] APDUCommand = { 
            (byte) 0x00, // CLA Class           
            (byte) 0xA4, // INS Instruction     
            (byte) 0x04, // P1  Parameter 1
            (byte) 0x00, // P2  Parameter 2
            (byte) 0x0A, // Length
            0x63,0x64,0x63,0x00,0x00,0x00,0x00,0x32,0x32,0x31 // AID
        };


    Intent intent = getIntent();
    Tag tag = intent.getParcelableExtra(NfcAdapter.EXTRA_TAG);
    IsoDep iso = IsoDep.get(tag);        
    iso.connect();

    byte[] result = iso.transceive(APDUCommand);

I am using the above code to read VisaPayWave NFC card details(card holder's name, expiry date, card number etc) using samsung galaxy s4. 我使用上面的代码使用三星galaxy s4阅读VisaPayWave NFC卡详细信息(持卡人姓名,有效期,卡号等)。 The output that i am getting is [106,-126]. 我得到的输出是[106,-126]。 I think the APDU command i am using is not correct. 我认为我使用的APDU命令不正确。 Kindly suggest the correct command. 请建议正确的命令。

Change your APDU command definition 更改您的APDU命令定义

byte[] APDUCommand = { 
        (byte) 0x00, // CLA Class           
        (byte) 0xA4, // INS Instruction     
        (byte) 0x04, // P1  Parameter 1
        (byte) 0x00, // P2  Parameter 2
        (byte) 0x07, // Length
        (byte) 0xA0,0x00,0x00,0x00,0x03,0x10,0x10 // AID
    };

As lletami answered, Visa payWave is typically selectable with the AID A0000000031010 . 作为lletami回答,维萨payWave是通常与AID选择A0000000031010 So you can use the APDU 所以你可以使用APDU

00 A4 04 00 07 A0000000031010 00

to select the payWave appplication. 选择payWave应用程序。

On contactless EMV payment cards, you could also select the PPSE (Proximity Payment System Environment) to retrieve a list of available applications (and their AIDs): 在非接触式EMV支付卡上,您还可以选择PPSE(邻近支付系统环境)来检索可用应用程序列表(及其AID):

00 A4 04 00 0E 325041592E5359532E4444463031 00

Selecting the EMV payment application is only the first step. 选择EMV支付应用程序只是第一步。 You would need to issue several further commands to get the readable credit card data (see this answer ). 您需要发出几个其他命令才能获得可读的信用卡数据(请参阅此答案 )。

For instance, you could issue a GET PROCESSING OPTIONS command (see eg this answer , this answer and this answer ). 例如,您可以发出GET PROCESSING OPTIONS命令(参见例如这个答案这个答案这个答案 )。

And/or you could issue READ RECORD commands to get data from known elementary files. 和/或您可以发出READ RECORD命令以从已知的基本文件中获取数据。 Eg 例如

00 B2 01 0C 00

to read record 1 of EF 1, 阅读EF 1的记录1,

00 B2 02 0C 00

to read record 2 of EF 1, or 读取EF 1的记录2,或

00 B2 01 14 00

to read record 1 of EF 2, etc. 阅读EF 2的记录1等

You can get the EMV specifications for payment systems from http://www.emvco.com/ to learn about possible commands and data structures. 您可以从http://www.emvco.com/获取支付系统的EMV规范,以了解可能的命令和数据结构。

Your response code [106, -126] is better represented as hexadecimal, rather than implying any signed values. 您的响应代码[106,-126]更好地表示为十六进制,而不是暗示任何有符号值。

It actually would be 6A82 - which forms SW1 and SW2 of the APDU Response Code. 它实际上是6A82 - 它形成了APDU响应码的SW1和SW2。 6A82 corresponds to "Wrong parameter(s) P1 P2; file not found". 6A82对应于“错误的参数P1 P2;未找到文件”。 See EMV Book 1 for more details. 有关详细信息,请参阅EMV Book 1。 Ie "0x63,0x64,0x63,0x00,0x00,0x00,0x00,0x32,0x32,0x31" was not found on the card - but "0xA0,0x00,0x00,0x00,0x03,0x10,0x10" should be. 即卡上找不到“0x63,0x64,0x63,0x00,0x00,0x00,0x00,0x32,0x32,0x31” - 但应该是“0xA0,0x00,0x00,0x00,0x03,0x10,0x10”。

As lletami says, your APDU command needs rebuilding, including the AID using 'compressed numeric' (as described in EMV Book 1), very similar to Binary Coded Decimal. 正如lletami所说,你的APDU命令需要重建,包括使用'压缩数字'的AID(如EMV Book 1中所述),非常类似于二进制编码的十进制。

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

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