Download Application Programming Notes, Java Card 3 Platform
Transcript
...
import javacard.framework.*;
import javacardx.apdu.ExtendedLength;
...
public MyApplet extends Applet implements
ExtendedLength {
...
}
2. Write your applet and Applet.process(..) method as you would with any
other applets. For consistency, it is advisable that your process(..) code
begin like the one below:
public void process(APDU apdu) {
byte[] buffer = apdu.getBuffer();
if (apdu.isISOInterindustryCLA()) {
if (this.selectingApplet()) {
return;
} else {
ISOException.throwIt (ISO7816.SW_CLA_NOT_SUPPORTED);
}
}
switch (buffer[ISO7816.OFFSET_INS]) {
case CHOICE_1:
...
return;
case CHOICE_2:
...
...
default:
ISOException.throwIt (ISO7816.SW_INS_NOT_SUPPORTED);
}
}
3. For cases 3S, 4S, 3E and 4E, write the method to handle incoming data. Do it
relying on API extensions so that your applet properly handles extended, as
well as non-extended, cases.
Chapter 4
Using Extended APDU
4-5