Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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. The output that i am getting is [106,-126]. I think the APDU command i am using is not correct. Kindly suggest the correct command.

like image 862
user3816152 Avatar asked Oct 21 '22 05:10

user3816152


2 Answers

Change your APDU command definition

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
    };
like image 99
lletami Avatar answered Oct 23 '22 02:10

lletami


As lletami answered, Visa payWave is typically selectable with the AID A0000000031010. So you can use the APDU

00 A4 04 00 07 A0000000031010 00

to select the payWave appplication.

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):

00 A4 04 00 0E 325041592E5359532E4444463031 00

Selecting the EMV payment application is only the first step. 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 e.g. this answer, this answer and this answer).

And/or you could issue READ RECORD commands to get data from known elementary files. E.g.

00 B2 01 0C 00

to read record 1 of EF 1,

00 B2 02 0C 00

to read record 2 of EF 1, or

00 B2 01 14 00

to read record 1 of EF 2, etc.

You can get the EMV specifications for payment systems from http://www.emvco.com/ to learn about possible commands and data structures.

like image 26
Michael Roland Avatar answered Oct 23 '22 03:10

Michael Roland