diff --git a/hwb1/card/install.cmd b/hwb1/card/install.cmd index 2ae810b..dddf7c7 100644 --- a/hwb1/card/install.cmd +++ b/hwb1/card/install.cmd @@ -1,2 +1,8 @@ +SET LENGTH=07 +SET AID=01020304050608 +SET CONTROLLENGTH=02 +SET CONTROLINFO=1122 +SET PINLENGTH=04 +SET PIN=31323334 @rem -f to force install over old version -gp --install %~dp0..\javacard\%PACKAGE%.cap -f +gp --install %~dp0..\javacard\%PACKAGE%.cap --params %LENGTH%%AID%%CONTROLLENGTH%%CONTROLINFO%%PINLENGTH%%PIN% -f diff --git a/hwb1/src/hwb1/MyApplet.java b/hwb1/src/hwb1/MyApplet.java index e9dd240..8312b8f 100644 --- a/hwb1/src/hwb1/MyApplet.java +++ b/hwb1/src/hwb1/MyApplet.java @@ -42,6 +42,14 @@ public class MyApplet extends Applet { register(); } + public boolean select() { + if (pin.getTriesRemaining() == 0) { + return false; + } else { + return super.select(); + } + } + /** * Processes an incoming APDU. * @@ -90,6 +98,9 @@ public class MyApplet extends Applet { Util.arrayCopy(buffer, ISO7816.OFFSET_CDATA, storage, (short) 0, length); } break; + case 0x20: + length = apdu.setIncomingAndReceive(); + pin.check(buffer, (short) ISO7816.OFFSET_CDATA, (byte)length); default: ISOException.throwIt(ISO7816.SW_INS_NOT_SUPPORTED); break;