Click here to Skip to main content
15,890,123 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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 ;
powerdown;

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?
Posted
Comments
Nagy Vilmos 30-Nov-12 5:34am    
A little bit of code may help, or are you expecting us to be telepathic.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900