Question

i am trying to read a smart card files , after a long search i can now send APDU command to select MF (Master File) but i need to access to EF (Elementary File) , here is the command i'm sending :

ResponseAPDU r = channel.transmit(new CommandAPDU(new byte[] { 0X00,(byte) 0XA4, 0X00, 0X00, 0X02, 0X3F, 0X00 }));

and here is the response :

6F 1C 82 01 38 83 02 3F 00 85 02 03 7F 86 0C 7F 7F 7F 7F 41 60 60 7F 7F 7F 60 00 8A 01 05 90 00

i know that i got a positif response 90 00 , so what next should i do in order to access to EF.

Was it helpful?

Solution

You now need to pick a file and select it with the same command. If you Google ISO7816-4 you Will find a few sites describing the read binary and read record commands. Depending on the file type you selected. There is not standard ISO command for listing DFs andd EFs, though. Try EFICCID (2FE2 IIRC) for a start, it is present in most cards.

OTHER TIPS

The best way to continue would be to get your hands on the specification detailing your application's logical data structure. These typically contain the command set you are expected to use in order to access / use the application data.

PKCS#15 aka ISO 7816-15 is not present on all cards. Please go for ISO 7816-4 instead. The elementary file EF.DIR (path 3F002F00, i.e. MF/EF.DIR) is the right place to look for the smartcard layout. First of all, you should issue a SELECT command (empty path indicates MF) with P1-P2 set to read the FCP template. If the smartcard is cleanly personalized, it lists you all EFs or DFs in the MF, respectively. If EF.DIR (2F00) is there, read and parse it. It is comprised of all the card applications present on the card (and how to select it). After that, you can recursively scan your card.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top