made java card classic applet using netbeans
when i program the read operation i check for the first byte in the APDU to be 0x80 then the second to be 0xB0 then take the offset that i will read from in the file from the byte 2 and 3 then take the number of bytes to be read from byte 4
to be the APDU as the default one
0x80 0xB0 0x00 0x03 0x60 this read 60 bytes from the current file starting by offset number 3
when i try this command it returned error Input data length != Lc around line 12.
after some retrying i find the problem
the problem is that the compiler assume that byte 4 is the length of data so in my command he wait for 60 bytes
when i search i find that byte 4 does not mean the sending data length when the INS=B0
i do not know why it made like this and when i try to debug the compiler did not enter the process function even.
my script file is
0x00 0xA4 0x04 0x00 0X06 0X87 0XF1 0X3F 0X5E 0X22 0X47 0x7F;
0x80 0xA4 0x00 0x00 0x02 0x3F 0x00 0x7F;
0x80 0xA4 0x00 0x00 0x02 0x50 0x15 0x7F;
0x80 0xA4 0x00 0x00 0x02 0x53 0x00 0x7F;
0x80 0xA4 0x00 0x00 0x02 0x50 0x31 0x7F;
0x80 0xB0 0x00 0x00 0x33 0x7F ;
the first one to select the program and then select files and then try to read data that is not work
but if i do 0x80 0xB0 0x00 0x00 0x02 0x00 0x00 it read 2 bytes write from offset 0 although the final 0x00 0x00 is not used even in the standard
my problem why i must to but data in the command to be as length of the data needed to be red
how can i fix this error?
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)