views:

42

answers:

1

Some smart cards offer the option to reference a file by an SFI (short file identifier), which is a 5-bit number. In contrast, a typical file identifier is 2 bytes long.

I need some assistance with figuring out how to do that, because I failed to find an answer inside ISO 7816-4.

First of all, section 5.3.1.1 states (emphasis mine)

Selection by short EF identifier — A short EF identifier may reference any EF. It consists of five bits not all equal, i.e., any number from one to thirty. When used as short EF identifier, the number zero, i.e., 00000 in binary, references the current EF. At MF level, the number thirty, i.e., 11110 in binary, is reserved (see 8.2.1.1). Short EF identifiers cannot be used in a path or as an EF identifier (e.g., in a SELECT command).

My way of interpreting this sentence is "you cannot use an SFI to select a file on the smart card" - which is not what I expect.

Further, section 7.1.1 specifies how the SELECT APDU command is supposed to be used; table 39 specifies the contents of P1. However, none of the examples indicate how to address it via SFI (all of them are about 2-byte identifiers).

So my questions are:

  1. What is the rationale behind adding SFI? 2 bytes per identifier was too much?
  2. How can a file be SELECTed, if its SFI is known?
+1  A: 

I found the answers to my questions after some extra-research.

  1. A file can be read directly via the SFI, without having to be SELECTed first. This allows you to save time (since no time is spent on selection).
  2. As discussed in #1, the point of an SFI is that you can read it immediately, thus the instructions that explain how a file can be read if its SFI is known are found in the description of the other commands - READ BINARY, READ RECORD, etc. See section 7.2.2 of the same doc
Alex