Problem loading Java Applet to smartcard
Hi!
The load command response is a 0x6A88.
Does the smartcard verifiy the contents of the cap file before the last block is loaded?
Here is the dump:
13 00 A4 04 00 08 A0 00 00 00 03 00 00 00
02 61 70
05 00 C0 00 00 70
114 6F 6E 84 08 A0 00 00 00 03 00 00 00 A5 62 73 2F 06 07 2A 86 48 86 FC 6B 01 60 0C 06 0A 2A 86 48 86 FC 6B 02 02 01 01 63 09 06 07 2A 86 48 86 FC 6B 03 64 0B 06 09 2A 86 48 86 FC 6B 04 01 05 9F 6E 2A 20 50 50 00 40 41 52 73 00 60 70 45 00 00 00 03 00 00 19 12 70 45 19 13 70 45 19 14 70 45 00 00 00 00 00 00 00 00 00 00 00 00 9F 65 01 FF 90 00
13 80 50 00 00 08 01 02 03 04 05 06 07 08
02 61 1C
05 00 C0 00 00 1C
30 00 00 70 45 00 00 00 03 00 00 02 01 E7 5E 74 60 AB B2 F0 02 DC F4 78 FD 04 36 79 4C 90 00
21 84 82 00 00 10 86 34 22 64 1C 50 48 1F 44 D0 24 2D D3 28 E7 50
02 90 00
14 80 E4 00 80 08 4F 06 A0 00 00 03 23 01 00
02 6A 88
Checking error: wrong parametere(s) P1-P2! 'Referenced data not found'
Thanks in advance!
# 1
I'm sorry it was the wrong dump.
Here is the correct one:
13 00 A4 04 00 08 A0 00 00 00 03 00 00 00
02 61 70
05 00 C0 00 00 70
114 6F 6E 84 08 A0 00 00 00 03 00 00 00 A5 62 73 2F 06 07 2A 86 48 86 FC 6B 01 60 0C 06 0A 2A 86 48 86 FC 6B 02 02 01 01 63 09 06 07 2A 86 48 86 FC 6B 03 64 0B 06 09 2A 86 48 86 FC 6B 04 01 05 9F 6E 2A 20 50 50 00 40 41 52 73 00 60 70 45 00 00 00 03 00 00 19 12 70 45 19 13 70 45 19 14 70 45 00 00 00 00 00 00 00 00 00 00 00 00 9F 65 01 FF 90 00
13 80 50 00 00 08 01 02 03 04 05 06 07 08
02 61 1C
05 00 C0 00 00 1C
30 00 00 70 45 00 00 00 03 00 00 02 01 82 73 D8 FD AB 96 E1 70 D1 FF 73 16 4D 82 1E 72 90 00
21 84 82 00 00 10 83 3D 90 08 84 80 6E F3 C8 DC 12 43 6B B6 6F 9B
02 90 00
25 80 E6 02 00 13 06 A0 00 00 03 23 01 08 A0 00 00 00 03 00 00 00 00 00 00 00
02 61 01
05 00 C0 00 00 01
03 00 90 00
207 80 E8 00 00 CA C4 C8 01 00 0F DE CA FF ED 01 02 04 00 01 05 A0 00 00 00 01 02 00 1F 00 0F 00 1F 00 0A 00 29 02 56 00 6C 21 BF 00 0A 03 F3 00 00 06 93 00 06 00 00 00 00 04 01 00 04 00 29 04 00 01 07 A0 00 00 00 62 01 01 01 01 07 A0 00 00 00 62 01 02 01 01 07 A0 00 00 00 62 02 01 00 01 07 A0 00 00 00 62 00 01 03 00 0A 01 06 A0 00 00 00 01 01 00 90 06 00 6C 00 80 03 13 00 0C 04 04 00 05 00 D1 FF FF 00 B4 00 ED 06 01 06 1F 06 3F 06 5F 06 89 00 83 00 02 00 01 01 11 00 00 1C F5 1D 6D 1D 94 1E 4D 1E 5A 1E 7D 1E B8 1E C2 1E CA 1E D3 1E DA 1E E7 1E F2 1E FD 1F 06 1F 17 1F 28 00 83 00 03 00 01 01 0D 00 00 1F 44 1F 9C 1F BE
02 6A 80
Checking error: wrong parametere(s) P1-P2! 'Incorrect parameters in data field'
# 2
INS=0xE4 is DELETE and not LOAD.
# 3
SW1-SW2 = 0x6A80 is 'Incorrect values in data field'.
# 4
Okay I assume you've read the first (wrong) dump with E4?The text message is wrong you're right.But what about the load command?Is the cap file wrong?Thanks.
# 5
Some reasons I can think of:
- DAP mandatory
- package AID is already present on-card
- card does not accept CAP file version (e.g. Card is compliant to JC 2.1.1 but CAP file indicates JC 2.2.1 package version)
- the structure of the CAP file component is not JC compliant
- card does not accept debug and/or custom components
- the size is too big
The INSTALL[for load] command is accepted, so we can rule out DAP and AID issues.
Your LOAD command indicates JC 2.1.1 . If you don't have a ancient JC version this should not be a problem neither.
JC compliancy:
It seems that the packa_name_info is missing in the Header component. Furthermore the order for Import and Applet component is not ?correct?.
Size:
Check if your card has sufficient free EEPROM available (Method component is already ~8.6kB).
# 6
Hi lexdabear!
Is a little bit strange!
I thougth the smartcard checks the first TLV value (COMPONENT_Header tag 01) and complains about a wrong version or something. But then I used very short LOAD APDUs and I always get an error after the second load command.
Here is the trace:
13 00 A4 04 00 08 A0 00 00 00 03 00 00 00
02 61 70
05 00 C0 00 00 70
114 6F 6E 84 08 A0 00 00 00 03 00 00 00 A5 62 73 2F 06 07 2A 86 48 86 FC 6B 01 60 0C 06 0A 2A 86 48 86 FC 6B 02 02 01 01 63 09 06 07 2A 86 48 86 FC 6B 03 64 0B 06 09 2A 86 48 86 FC 6B 04 01 05 9F 6E 2A 20 50 50 00 40 41 52 73 00 60 70 45 00 00 00 03 00 00 19 12 70 45 19 13 70 45 19 14 70 45 00 00 00 00 00 00 00 00 00 00 00 00 9F 65 01 FF 90 00
13 80 50 00 00 08 01 02 03 04 05 06 07 08
02 61 1C
05 00 C0 00 00 1C
30 00 00 70 45 00 00 00 03 00 00 02 01 97 1F 1E 04 BB 20 CC 80 59 6D 94 AB F6 C5 A8 7D 90 00
21 84 82 00 00 10 1C 94 30 C3 B6 B3 7F AE CA 8B 2E 9D 72 C5 DA D4
02 90 00
24 80 E6 02 00 12 05 A0 00 00 00 01 08 A0 00 00 00 03 00 00 00 00 00 00 00
02 61 01
05 00 C0 00 00 01
03 00 90 00
10 80 E8 00 00 05 C4 03 01 00 10 /* Here I changed the length because of the missing package_name_info adding a zero byte (without success)*/
02 61 01
05 00 C0 00 00 01
03 00 90 00
10 80 E8 00 01 05 C4 03 DE CA FF
02 6A 80
# 7
Looking back at your previous post the package AID in the INSTALL[for load] command does not match the package AID in the header component.
Debugging the LOAD process can become quite cumbersome. Try to load this cap file with JCOP tools on the simulator and compare the APDUs. If you don't have the tools available you can send me the cap file and I will post the trace.
# 8
HI!Okay I've send you an email.Thanks in advance.
# 9
I took the raw CardEdge.cap file apart into the components defined in JC VM. Then I zipped it back to CardEdge.cap, containing each component:StaticField.cap
RefLocation.cap
Method.cap
Import.cap
Header.cap
Directory.cap
ConstantPool.cap
Class.cap
Applet.cap
Problems I found:
- According to JC VM spec. all components but Applet, Export and Debug are mandatory. In our case not only the optional Debug and Export components are missing, but also the mandatory Descriptor component. JCOP Tools shows me thisjcshell: Cannot read <C:/javacard/CardEdge.cap>: Incomplete CAP file, missing mandatory component: Descriptor.cap
- The package AID in the INSTALL[for load] command does not match the package AID in the header component --> 0x6A80 after the first LOAD command