Hello,
I'm trying to understand the Wallet example with JCOP 3 tools but I have some issues.
The script line
// create wallet applet
0x80 0xB8 0x00 0x00 0x14 0x0a 0xa0 0x00 0x00 0x00 0x62 0x03 0x1 0x0c 0x06 0x01 0x08 0x00 0x00 0x05 0x01 0x02 0x03 0x04 0x05 0x7F;
--------------------------------------------------------------------------------------------------
Part of the file Wallet.java
private Wallet(byte[] bArray, short bOffset, byte bLength) {
pin = new OwnerPIN(PIN_TRY_LIMIT, MAX_PIN_SIZE);
byte iLen = bArray\[bOffset\]; // aid length
bOffset = (short) (bOffset + iLen + 1);
byte cLen = bArray\[bOffset\]; // info length
bOffset = (short) (bOffset + cLen + 1);
byte aLen = bArray\[bOffset\]; // applet data length
pin.update(bArray, (short) (bOffset + 1), aLen);
register();
} // end of the constructor
What are the values of: initial bOff, iLen, cLen, aLen and final bOff ???
Because assuming that
AID = 0xa0 0x00 0x00 0x00 0x62 0x03 0x1 0x0c 0x06 0x01
bOffset = 5 // initial bOffset
bArray = 0x80 0xB8 0x00 0x00 0x14 0x0a 0xa0 0x00 0x00 0x00 0x62 0x03 0x1 0x0c 0x06 0x01 0x08 0x00 0x00 0x05 0x01 0x02 0x03 0x04 0x05 0x7F
Then
iLen = bArray[bOffset] = bArray[5] = 0x0A = 10 (in decimal) // OK aid length !!!
bOffset = (short) (bOffset + iLen + 1) = 5 + 10 + 1 = 16 (in decimal)
cLen = bArray[bOffset] = bArray[16] = 0x08 = 8 (in decimal) // OK info length !!
bOffset = (short) (bOffset + cLen + 1) = 16 + 8 + 1 = 25 (in decimal)
aLen = bArray[bOffset] = bArray[25] = 0x7F // Error !!! It is different from the applet data length
And final bOffset is not 25 (as calculated) but 19 because bArray[19] = 0x05 = aLen
I dont understand
aLen = 0x7F ??? But aLen = 0x05 = 5 (in decimal) how is it possible ???
And final bOffset = 25 ??? But the correct final bOffset = 19
Can anyone help me please???