Reputation: 1760
I want to install applets on Java Card with C# program. I've successfully steps 1-4.
I'm having trouble at step 5. Send LOAD (80 E8 00 00 XX..)
, What is Command data field (C482099B010023DEC..)
of LOAD
come from?
I tried read the .cap file as parameters but failed. Thanks.
To install the applet in Java Card:
1. Open the reader.
2. Send SELECT to select ISD(AID)
3. Initiate the Secure Channel (INITIALIZE UPDATE and EXTERNAL AUTHENTICATE).
4. Send INSTALL[for Load] (80 E6 02 00 XX..).
5. Send LOAD (80 E8 00 00 XX..).
6. Send INSTALL[for Install] (80 E6 0C 00 XX..).
//
<<80 E8 00 00 FF C4 82 09 9B 01 00 23 DE CA FF ED 02 02 04 00 01 07 4C 6F 79 61 6C 74 79 11 4C 6F 79 61 6C 74 79 43 61 72 64 41 70 70 6C 65 74 02 00 21 00 23 00 21 00 0F 00 1F 00 EA 00 0E 07 1B 00 3E 00 BD 00 00 02 19 10 AF 00 0C 00 06 00 22 03 01 00 04 00 1F 03 02 01 07 A0 00 00 00 62 01 01 02 01 07 A0 00 00 00 62 01 02 02 01 07 A0 00 00 00 62 02 01 03 00 0F 01 0B 4C 6F 79 61 6C 74 79 43 61 72 64 00 55 06 00 0E 00 00 00 80 03 0A 00 06 07 01 00 00 00 63 07 07 1B 00 05 40 18 8C 00 0C 18 03 89 00 18 03 89 01 18 06 11 00 80 03 8D 00 0E 94 00 00 10 87 02 18 05 03 8D 00 0D 87 03 18 05 8D 00 0F 87 04 18 8F 00 0A 3D 06 10 08 8C 00 0B 87 05 18 10 08 90 0B 87 06 18 10 10 90 0B 87 07 18 03 88 08 18 03 88 09 18 8B 00 11 7A 05 30 8F 00 12 3D 18 1D 1E 8C 00 13 3B 7A 02 21 18 8B 00 14 00
>>00 90 00
5. LOAD
------------------------------------------------------------
CLA 80 GlobalPlatform command
No secure messaging
Logical channel 0
INS E8 LOAD
P1 00 More blocks
P2 00 Block number
Lc field FF length of data field
Command data field C482099B010023DECAFFED0202040001074C6F79616C7479114C6F79616C7479436172644170706C657402002100230021000F001F00EA000E071B003E00BD0000021910AF000C0006002203010004001F03020107A0000000620101020107A0000000620102020107A000000062020103000F010B4C6F79616C747943617264005506000E00000080030A000607010000006307071B000540188C000C18038900180389011806110080038D000E9400001087021805038D000D870318058D000F8704188F000A3D0610088C000B8705181008900B8706181010900B87071803880818038809188B00117A05308F0012ECAFFED0202040001074C6F79616C7479114C6F79616C7479436172644170706C657402002100230021000F001F00EA000E071B003E00BD0000021910AF000C0006002203010004001F03020107A0000000620101020107A0000000620102020107A000000062020103000F010B4C6F79616C747943617264005506000E00000080030A000607010000006307071B000540188C000C18038900180389011806110080038D000E9400001087021805038D000D870318058D000F8704188F000A3D0610088C000B8705181008900B8706181010900B87071803880818038809188B00117A05308F00123D181D1E8C00133B7A0221188B0014
Le field 00
------------------------------------------------------------
Upvotes: 0
Views: 82
Reputation: 6298
You have to add there the extracted CAP file content in a specific order.
This logic is used to trigger the loading process. The tag C4 is important + the length which is then handled in this function.
The load file is extracted to a buffer with this logic, basically the CAP, which is zip file, is extracted and all components according to the Java Card Specification are concatenated which is done here.
It can be more complex if a load file signature is used or the load file should be encrypted but this is rarely used.
Upvotes: 1