How to determine in the APDU command from which position to execute READ RECORD?

116 views Asked by At

I'm trying to get the PAN from different cards (VISA, MASTERCARD). I can't understand how to form a READ RECORD command, as it may differ for each card.

Here's the sequence I have after receiving the card's ATS:

  1. Using the command 2PAY.SYS.DDF01: 00A404000E325041592E5359532E4444463031, I obtain the card's AID.
  2. I perform a SELECT based on the obtained AID: 0A0000A4040007A0000000031010.
  3. I execute READ RECORD: 00 B2 P1 P2 00.
    For different cards, P1 P2 are different, for example:
    00 B2 01 0C 00
    00 B2 03 14 00
    00 B2 02 14 00
    00 B2 01 14 00

How can I determine in advance what values of P1 P2 should be used for the current card in the READ RECORD command, and what are their initial and final values?


The approximate response to my own question has been formed. But I'm not sure if it's correct (and even if it is correct, I still have a problem with obtaining GPO or GET DATA).

Did I understand correctly that: P1 is the record number, and P2 is some kind of identifier for the file? And in order for us to know these P1 and P2 values, we need a list of SFIs, and SFIs, in turn, are obtained using GPO or GET DATA? If so, then I tried to do GPO and GET DATA, but I get an error 6A 81 on these actions. Here is the GPO command: 80CA000000 which I do immediately after SELECT.

0

There are 0 answers