[Pls help] Problem with wallet example on simulator
hello!
I ran the wallet eg in the java card kit 2.2.2 on the simulator from SmartCafe professional: http://www.wrankl.de/Javacard/Javacard.html
every works fine until the part where i tested the APDU commands.
:INSTALL80 E6 84 00 23 09 a0 00 00 00 62 03 01 0c 06 0a a0 00 00 00 62 03 01 0c 06 01 0a a0 00 00 00 62 03 01 0c 06 01 00 00 00 00
Install APDU initially did not work, throwing a javacard.framework.pinException. But managed to fix it by changing
- pin.update(bArray, (short)(bOffset+1), aLen);to
- pin.update(bArray, (short)(bOffset+1), MAX_PIN_SIZE);in the wallet constructor. I received a 90 00 response.
However, when i tried to run the select APDU to select the applet
:SELECT00 A4 04 00 0a a0 00 00 00 62 03 01 0c 06 01 7F
it throws a java.lang.NullPointerException now.
Can anyone help me please?
; Wallet AID = a0 00 00 00 62 03 01 0c 06 01
; Wallet PACK AID = a0 00 00 00 62 03 01 0c 06
[984 byte] By [
30centsa] at [2007-11-27 11:09:59]

# 1
If each element of bArray represent one pin's number
I think that you must change the
- pin.update(bArray, (short)(bOffset+1), MAX_PIN_SIZE); to
- pin.update(bArray, (short)0, MAX_PIN_SIZE);
and MAX_PIN_SIZE must be something like
byte MAX_PIN_SIZE = (byte)0x04; //pin length = 4
Else go to Java card API reference...
I hope that was helpfull...
# 2
thanks for your help vcalmalio.
Anyway used the older version wallet example i found on the net and it managed to work on the JCWDE simulator.
Java Card 2.2.2 wallet sample:
private Wallet (byte[] bArray,short bOffset,byte bLength) {
pin = new OwnerPIN(PIN_TRY_LIMIT,MAX_PIN_SIZE);
byte iLen = bArray[bOffset]; // aid length
System.out.println("initial bOffset:"+bOffset);
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);
Java Card 2.1.2 wallet sample:
pin = new OwnerPIN(PIN_TRY_LIMIT,MAX_PIN_SIZE);
pin.update(bArray, (short)(bOffset+1), bLength);
The Smartcafe professional simulator is still giving me this problem though:
javacard.framework.PINException
which means i am back to square one. :)
The funny thing is that when i hard code the bLength by using:
pin.update(bArray, (short)(bOffset+1), (BYTE)5);
IT works.
which puzzles me since, when i did a system.out.println() of bLength when running the JCWDE simulator it gives me a 5 too... so logically there should be no error rite? lol
Is it because the smartcafe simulator runs its applets from CAP files instead of .class files like JCWDE and thus causes the parameters for install() to change?
Can anyone enlighten me on how the default pin is passed into the install() when the applet is installed? who sets the default pin "12345"? (which i managed to see by using a series of system.out.print)