FileDocCategorySizeDatePackage
SampleBioServer.javaAPI DocJava Card3665Wed Mar 22 21:07:24 GMT 2006com.sun.javacard.samples.biometry.bioServer

SampleBioServer

public class SampleBioServer extends Applet implements SharedBioTemplate
package AID: A0:00:00:00:62:03:01:0C:0f:01 applet AID: A0:00:00:00:62:03:01:0C:0f:01:01

Fields Summary
public static final byte
CLA
public static final byte
INS_ENROLL
public static final byte
MATCH_TRY_LIMIT
private OwnerBioTemplate
impl
Constructors Summary
protected SampleBioServer(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);
        }
        impl = BioBuilder.buildBioTemplate(BioBuilder.PASSWORD,MATCH_TRY_LIMIT);
    
Methods Summary
public voidenrollData(APDU apdu)
method takes in the data This implementation assumes that all the password data is given in the enroll method.

        byte []buffer = apdu.getBuffer();
        short bytesRead = apdu.setIncomingAndReceive();           
        impl.init(buffer, ISO7816.OFFSET_CDATA, bytesRead);
        impl.doFinal();
        //enrollment complete
    
public bytegetBioType()

        return impl.getBioType();
    
public shortgetPublicTemplateData(short publicOffset, byte[] dest, short destOffset, short length)

        return impl.getPublicTemplateData(publicOffset,dest,destOffset,length);
    
public ShareablegetShareableInterfaceObject(AID clientAID, byte parameter)

        return this;        
    
public bytegetTriesRemaining()

        return impl.getTriesRemaining();
    
public shortgetVersion(byte[] dest, short offset)

        return impl.getVersion(dest,offset);
    
public shortinitMatch(byte[] candidate, short offset, short length)

        return impl.initMatch(candidate,offset,length);
    
public static voidinstall(byte[] bArray, short bOffset, byte bLength)
Installs this applet.

param
bArray the array containing installation parameters
param
bOffset the starting offset in bArray
param
bLength the length in bytes of the parameter data in bArray

        new SampleBioServer(bArray,bOffset,bLength);
    
public booleanisInitialized()

        return impl.isInitialized();
    
public booleanisValidated()

        return impl.isValidated();
    
public shortmatch(byte[] candidate, short offset, short length)

        return impl.match(candidate,offset,length);
    
public voidprocess(APDU apdu)
Processes an incoming APDU.

see
APDU
param
apdu the incoming APDU
exception
ISOException with the response bytes per ISO 7816-4

         byte buffer[] = apdu.getBuffer();
         // check SELECT APDU command
         if(selectingApplet())
             return;
         switch (buffer[ISO7816.OFFSET_INS]){
             case INS_ENROLL:
             enrollData(apdu);
             break;
             default:
            ISOException.throwIt(ISO7816.SW_INS_NOT_SUPPORTED);
         }
    
public voidreset()

        impl.reset();