Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: Java
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 14-Nov-12 1:55am
Comments
Nagy Vilmos at 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)

  Print Answers RSS
0 OriginalGriff 7,903
1 Sergey Alexandrovich Kryukov 7,192
2 DamithSL 5,604
3 Manas Bhardwaj 4,986
4 Maciej Los 4,820


Advertise | Privacy | Mobile
Web03 | 2.8.1411023.1 | Last Updated 14 Nov 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100