SamplePasswdBioAppletpublic class SamplePasswdBioApplet extends Applet package AID: 0xA0:0x00:0x00:0x00:0x62:0x03:0x01:0x0C:0x0f:0x02
applet AID: 0xA0:0x00:0x00:0x00:0x62:0x03:0x01:0x0C:0x0f:0x02:0x01 |
Fields Summary |
---|
public static final byte | CLA | public static final byte | INS_GET_REQ | public static final byte | INS_MATCH | public static final short | ERROR_MATCH_FAILED | private SharedBioTemplate | bioImpl | private static final byte[] | BIO_SERVER_AID |
Constructors Summary |
---|
protected SamplePasswdBioApplet(byte[] bArray, short bOffset, byte bLength)Only this class's install method should create the applet object.
byte aidLen = bArray[bOffset];
if (aidLen== (byte)0){
register();
} else {
register(bArray, (short)(bOffset+1), aidLen);
}
AID bioServerAID = JCSystem.lookupAID(BIO_SERVER_AID,(short)0,(byte)BIO_SERVER_AID.length);
bioImpl = (SharedBioTemplate)JCSystem.getAppletShareableInterfaceObject(bioServerAID,(byte)0);
|
Methods Summary |
---|
public void | getRequirements(APDU apdu)method returns the public template data.
byte []buffer = apdu.getBuffer();
//byte []pubTemp = JCSystem.makeTransientByteArray((short)4,JCSystem.CLEAR_ON_DESELECT);
short length = bioImpl.getPublicTemplateData((short)0, buffer, (short)0, (short)buffer.length);
apdu.setOutgoing();
apdu.setOutgoingLength(length);
apdu.sendBytes((short)0,length);
| public static void | install(byte[] bArray, short bOffset, byte bLength)Installs this applet.
new SamplePasswdBioApplet(bArray,bOffset,bLength);
| public void | match(APDU apdu)following match method matches the password passed in with the reference
template
byte []buffer = apdu.getBuffer();
short bytesRead = apdu.setIncomingAndReceive();
short result = bioImpl.initMatch(buffer, ISO7816.OFFSET_CDATA, bytesRead);
if(result < BioTemplate.MINIMUM_SUCCESSFUL_MATCH_SCORE){
ISOException.throwIt(ERROR_MATCH_FAILED);
}
| public void | process(APDU apdu)Processes an incoming APDU.
byte buffer[] = apdu.getBuffer();
// check SELECT APDU command
if(selectingApplet())
return;
switch (buffer[ISO7816.OFFSET_INS]){
case INS_GET_REQ:
getRequirements(apdu);
break;
case INS_MATCH:
match(apdu);
break;
default:
ISOException.throwIt(ISO7816.SW_INS_NOT_SUPPORTED);
}
|
|