4
votes

I'm working on a C platform and I want to read the AFL of a card. If the previous command, select of the AID, don't give me a PDOL tag, it's ok: I can read the AFL without issues. But I need to write a method that can generate a GET PROCESSING OPTION regardless the PDOL.

So the questions are:

  1. How can I write an universal method that work despite the PDOL?
    Have I to map every single possible TAG?
  2. How can I format the GPO command with the correct data? Look the following example:

SELECT AID Response PDOL: 9F 1A 02 So I have to put the Terminal Country Code, in my case Italy: 380 So the GPO call is:

80 A0 00 00 04 83 02 03 80 00

But the response that I have is 6D 00: Instruction code not supported or invalid

Where am I wrong?

I'm programming on Ingenico Pos (Point of sale).

3
Provide us with more details, for example what reader you use. - itachi
EMV book 3 says when PDOL is not returned the GET PROCESSING OPTIONS command uses a command data field of '8300', indicating that the length of the value field in the command data is zero. - малин чекуров
@itachi I'm working on an Ingenico Pos. - Valerio Colonnese
@малинчекуров Yes, thanks, I know. As I said, if the card has no PDOL I can reach the AFL. - Valerio Colonnese

3 Answers

5
votes

Good to know that you are aware with the concept of PDOL very well. As far I can understand with your question, you are comfortable to construct GPO command if PDOL is not present. I think You are in doubt to write a generic function to construct GPO APDU command.

First of all I want to tell you that if PDOL information is present in SELECT response then you should send PDOL data in GPO command APDU, otherwise card application may throw some error.

So you can set an indicator when you receive PDOL in SELECT command. If PDOL is not there you can simply send 80 A8 00 00 02 83 00 00 and if your indicator stated that PDOL is required then simply parse the PDOL and from SELECT response and prepare a value for PDOL data if you know (as you described in your question) to be send in GPO command APDU.

If you don't know what value then you can simply fill hexadecimal zeros in value field.

Taking your example : 80 A8 00 00 04 83 02 03 80 00. This is the correct command (I have corrected INS byte). Or you can also send 80 A8 00 00 04 83 02 00 00 00 (PDOL value is replace by zeros)

I think this explanation can help you to get the answers of both the questions. Try it and let us know if there is any further clarification needed.

4
votes

You have two options:

  1. Issue a command with data field of "8300" - 80 A8 00 00 02 83 00 00
  2. Issue a command with data field of all hexadecimal zeroes - 80 A8 00 00 04 83 02 00 00 00

You receive the error, because in option 1 you omit the Le byte of the C-APDU - this byte is mandatory for all CASE 4 commands and in option 2 you give wrong INS byte, A0 instead of A8.

0
votes

Card Issuers don't put just any tag and expect the terminal to provide the data. You can get the best practices(recommended tags) from each payment scheme you are certifying with. Besides, if it is some tag which you don't support, you can always zero fill and proceed.