Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.1k views
in Technique[技术] by (71.8m points)

nfc - Getting Parser error on request for GPO command for EMV card

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
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...