Page 1 of 1
personalisation
Posted: Thu Jul 26, 2018 7:46 am
by naresh
Hello sir,
How i can check whether the my applet is personalized or not...?
Regards,
Thammineni Naresh.
Re: personalisation
Posted: Thu Jul 26, 2018 10:22 pm
by kuafu
Code: Select all
package PA ;
import javacard.framework.*;
public class few extends Applet
{
public static void install(byte[] bArray, short bOffset, byte bLength)
{
new few().register(bArray, (short) (bOffset + 1), bArray[bOffset]);
}
few(){
personalized = false;
}
public boolean personalized ;
void process_personalized(){
// check whether the my applet is personalized or not
if(personalized){
ISOException.throwIt(ISO7816.SW_CONDITIONS_NOT_SATISFIED);
}
// do personalized stuff
// ....
// set personalized true;
personalized = true;
}
public void process(APDU apdu)
{
if (selectingApplet())
{
return;
}
byte[] buf = apdu.getBuffer();
switch (buf[ISO7816.OFFSET_INS])
{
case (byte)0x00:
process_personalized();
break;
default:
ISOException.throwIt(ISO7816.SW_INS_NOT_SUPPORTED);
}
}
}
Using a boolean variable to mark the state of personalized .