javasmartcardapduemvtlv

How to decode APDU GPO response wrapped in tag 77


I followed this tutorial and I have recieved the following response from the GPO command:

7716820239009410100101011002020018010200200102009000

When I try parsing the response:

response tag = 77
AIP = ??
AFL = ??

Could some one help me with a method of getting the Application Interchange Profile (AIP) and Application File Locator (AFL). The tutorial explains only that with tag 80, and the reference book EMV_v4.3_Book_3_Application_Specification says that tag 77 is out of their solution scope.


Solution

  • The response that you got in return to the GET PROCESSING OPTIONS command is in BER-TLV format and decodes like this:

    77 16    [tag = Response Message Template Format 2, length = 22 bytes]
        82 02    [tag = Application Interchange Profile, length = 2 bytes]
            3900    [value = AIP]
        94 10    [tag = Application File Locator (AFL), length = 16 bytes]
            10010101100202001801020020010200    [value = AFL]
    
    9000    [status word = no error]
    

    For decoding BER-TLV by hand, you could use am online parser like https://www.emvlab.org/tlvutils/. For integration into your own application, you might want to have a look at Is there a Java parser for BER-TLV?.