Getting Parser error on request for GPO command for EMV card
Asked Answered
T

1

4

I have some issues with the GET PROCESSING OPTIONS (GPO) command for a VISA card.

Following is my response to the SELECT command for the VISA application:

6F408407A0000000031010A535500A564953412044454249549F380C9F66049F02069F37049F1A025F2D02656EBF0C1242034761735F550255539F5A0511084008409000

I extracted the following PDOL from this: 9F66049F02069F37049F1A02

I'm not sure about tag 9F66.

My GPO command then looks like this:

80a800000100000001000000001000823DDE7A12400

But I get a parser error as response:

6A80
Treadle answered 11/5, 2014 at 7:49 Comment(0)
S
12

Your GPO command seems to have quite a lot of issues:

80 A8 0000 01       00000001 000000001000 823DDE7A 1240 0
           ^^ ^^^^^ ^^^^^^^^                       ^^^^ ^^
           4. 1.      2.                             3.   5.
  1. First of all, your GPO command sends several data bytes without context. You need to wrap your data items into a PDOL related data object:

    83 10 wwwwwwww xxxxxxxxxxxx yyyyyyyy zzzz
    
  2. Your Terminal Transaction Qualifiers (9F66) have RFU bits set. Valid TTQ could look like this: B620C000, with

    • B6:
      • Mag-stripe mode supported @bit 8
      • EMV mode supported @bit 6
      • EMV contact chip supported @bit 5
      • online mode supported @bit 4
      • online PIN supported @bit 3
      • signature supported @bit 2
      • other bits = RFU
    • 20:
      • no online cryptogram required @bit 8
      • no CMV required @bit 7
      • (contact chip) offline PIN supported @bit 6
      • other bits = RFU
    • C0:
      • issuer update processing supported @Bit 8
      • consumer device CVM supported @Bit 7
      • other bits = RFU
    • 00: RFU
  3. Your Terminal Country Code is not valid. A terminal country code must be a 3-digit numeric value BCD-encoded into the two bytes. Assuming that you wanted to use "124" (Cananda), the correct country code would be 0124 (Austria: 0040, UK: 0826, USA: 0840).

  4. The Lc byte (set to 01 = one data byte) does not reflect the actual data length. In your case, the actual data length would be 16 bytes, so Lc should be set to 10. Considering that you also need to include the tag and length for the PDOL related data object, your Lc byte should be set to 12 (18 bytes).

  5. The hexadecimal string that you presented as your GPO command is not aligned to bytes, so you are missing one nibble of the Le field. You Le field shoud be set to Le.

So your GPO command could look like this:

80 A8 0000 12 83 10 B620C000 000000001000 823DDE7A 0124 00
Slow answered 11/5, 2014 at 9:40 Comment(20)
Thanks Micheal for detailed explanation But unfortunately getting the response 6A80.looking on to the data daoption for the tag ,I'm trying through mobile nfcTreadle
@SaravanaCd see my updated answer, the PDOL related data has tag 83 and not 9F38.Slow
I tried to use above command APDU but unfortunately app is crashing ,Tried changing the APDU as below 80a800002 83 10B620C000000000001000823DDE7A012400 but still getting the same response.Treadle
@SaravanaCd Is the app crashing or do you get an error code as result? Also the APDU you show in your command does not match the APDU I gave you!Slow
@Micheal ,I'm not getting any result and app is crashing when I sent the APDU command which you suggested, but when I sent the above APDU i get a response as 6A80.Not Sure still looking to match APDUTreadle
@SaravanaCd What exception do you get when your app crashes?Slow
@ Micheal,I'm sorry for my delay in response, Currently app is not crashing but not getting any response for the above get proc option command. One question I have with the length: Should le be 18 and 83 tag length should be 16 right?Treadle
@SaravanaCd Lc is 18 (0x12) and the length of DO 83 is 16 (0x10). If you don't get any response at all (not even an error status word), the communication with the card might have gotten interrupted, though a good API should throw some exception in that case (you are not dropping any exceptions, right?). What reader are you using?Slow
Thanks...Yes the tag is getting lost,I'm using Android mobile with NFC and using IsoDep android library.Not sure why but I'm getting response when sending default preproc 80a8000002830000.Treadle
@SaravanaCd A TagLostException (or sometimes also a simple IOException) in "response" to a GPO command that initializes the card's crypto components while receiving a normal error code in response to an invalid GPO command (i.e. one that does not start crpyto operations) may be an indication that the card does not receive sufficient power from the phone.Slow
@ Michael ,Yes you are right ,the tag was getting lost,I increased the connection timeout and seems to be getting response without any issues.Thanks for all your support,very much appreciated. I have an issue with NFC phone ,where i could see a lot of lag with ISO 14443 Type B cards compared to Type A Cards,Do you know what could be the reason?Treadle
Can you explain in detail, how did you arrive at the above command from the obtained PDOL?Excavation
I have already read it but still don't understand it, care to elaborate? I mean what is 10 doing here and how to get the country code and what the heck is the binary doing in between and how do you arrive at that hex code?Excavation
@Excavation 0x10 is the length value of the PDOL related data TLV. Country code is the 3 digit numeric ISO country code. I'm not sure what you mean with the rest. You should definitely read the EMV specifications to get an understanding.Slow
If 10 is the length what is 12? How do you get country code? Binary I am talking about is 000000001000 and hex I am talking about is 823DDE7A. I have read the specification 100 times but can't seem to figure out how to arrive at this command. Please help me.Excavation
@Excavation Yes, both are length fields, 0x10 the length of the TLV structure and 0x12 the length of the APDU command. That value is not binary, everything is in hexadecimal digits. 000000001000 is 10.0 units of whatever currency. 823DDE7A is anything (a random ("unpredictable") number). Again, read the specifications they are pretty clear on this.Slow
Which part of specification covers this because I have gone through book 3 and nothing in it covers this explanation.Excavation
@Excavation Book 1 covers the structure of APDU commands. Book 3 explains the TLV format and data object lists. Both, books 1 and 3 contain lists of data objects (including their tags and value format). The data element format conventions are described in book 3. The data objects "Amount, Authorised" and "Unpredictable Number" are, for instance, described in book 3.Slow
@michael Thank you souch for your generous help. I finally solved the issue!Excavation
Hi @Excavation I am getting same response as 6A80 and my gpo command is 83217620C0000500000000000000000000000634000000000006342007210091C1F7A7 could you please help meCarillon

© 2022 - 2024 — McMap. All rights reserved.