Search code examples
pythonsmartcardisopyscard

PyScard - What is the interpretation of the data obtained after executing GET RESPONSE?


I'm trying to figure out the file hierarchy within a contact smart card using pyScard and ISO 7816 commands.

The first thing I do is selecting the master file (INS = 0xA4) using

    connection.execute([0x0, 0xA4, 0x0, 0x0, 0x0])

This returns ([ ], 0x61, 0x19) which means I have to run a GET_RESPONSE (INS = 0xC0) command in order to get the answer.

To do so I run

    connection.execute([0x0, 0xC0, 0x0, 0x0, 0x19])

which returns a set of bytes (besides the 0x90 00).

If I understand it correctly, by running the SELECT FILE I've selected the master file but I don't seem to find an interpretation for those bytes that I receive with GET RESPONSE, what does that mean? How do you interpretate them?

Thanks!! :)


Solution

  • Thanks guidot!!

    GET RESPONSE has no definition of its own for a card speaking T=0, which you seem to have. You have to look at SELECT command. Its quite clear, that a typical card will return a number of FCIs (file control parameter data objects) wrapped in an 62/64/6F tag in TLV-format, but you have to compare this by looking at the response you receive. A card can return something completely proprietary however and still claim to conform to 7816-4. Without an OS manual you are out of luck then.