Search code examples
javafingerprint

DigitalPersona Java SDK- Comparing featureset and template


Am using digitalpersona one touch for windows java edition, I captured a fingerprint template using an applet, the applet serialize the template then convert it from a byte array to a hexstring to display it in a hidden textbox and is sent to server side and stored in mysql. My code can retrieve the template,and convert it back to an array but i dont know how to deserialize it and create the template again:

   Connection con = null;  
try {
    Class.forName("com.mysql.jdbc.Driver");
     con = DriverManager.getConnection("jdbc:mysql://localhost:3306/biodb", "root", "1234");
    PreparedStatement st;
    st = con.prepareStatement("select template from login where username = ? ");
    st.setString(1, username);

    ResultSet result = st.executeQuery();

    if (result.next()) { //.next() returns true if there is a next row returned by the query.

        String dbTemplate = result.getString("template");
          byte[] data = new byte[1];
            data = hexStringToByteArray(dbTemplate);
           DPFPTemplate t = DPFPGlobal.getTemplateFactory().createTemplate();
            t.deserialize(data);

Solution

  • You have to create a matcher to compare the featureSet and the tmeplate, something like this:

    DPFPVerification matcher = DPFPGlobal.getVerificationFactory().createVerification();
    DPFPTemplate template = DPFPGlobal.getTemplateFactory().createTemplate();
    template.deserialize(byteArray);
    DPFPVerificationResult result = matcher.verify(featureSet, template);