I am trying to read a file that is under MF. The EF.DIR file. I got the file's SFID, so I don't use the method SELEC_FILE first (since it's not necessary). I might be having some problems with understanding the P2 parameter (the OFFSET). I read couple of explanations, but still don't get what OFFSET do they mean. But I tried all the numbers from 0-8 just in case, none worked.
CLA = 0x00
INS_READ = 0xB0
P1_READ = 0x9E (by the datasheed: bit(8) = 1, bit(7:6) = 00, bit(5:1): SFID)
P2 = 0x04 (I figured that the offset should be from bit0 to bit4 (the SFID)
Le = 0 (by the datasheet I have, this should mean that any size will be returned)
This is my code:
byte[] readBinary = { CLA, INS_READ, P1_READ, (byte) 0x04, (short) 0};
ResponseAPDU read = channel.transmit(new CommandAPDU(readBinary));
String responseReadToString =read.toString();
System.out.println("Response Read: " + responseReadToString + "\n" + "Response Read (HEX): " + responseReadHex );
The output I get in Console is:
Response Read: ResponseAPDU: 2 bytes, SW=6b00
Response Read (HEX): 6B00
Explanations of SW1-SW2 for 6B00:
Incorrect parameters P1-P2
I really don't know what is wrong and it's really hard to find support on SmartCards online, so hopefully someone who knows this better can help me out. I also tried with using SELECT_FILE first and the use READ_BINARY after it (without the SFID in P1 parametr ofcourse), but it responded with "No EF is set as current".
Any help guys?