0

我正在尝试使用 digitalpersona one touch for windows sdk java edition 创建一个肥皂网络服务方法来匹配指纹。我从客户端的小程序中捕获功能集,并将其与服务器端的模板进行比较。但我需要反序列化它并再次创建功能集,以便我可以将它与模板进行比较。

我不知道如何重新创建功能集以便我可以将其用于验证:

//This is for template retrieval: (no problem here) 

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



            byte[] fsArray = new byte[1];
            fsArray = hexStringToByteArray(ftSet);

      //the problem is here, I've already converted it back into bytearray[] but i need to deserialize it and create the feature set again.

             featureSet.deserialise(fsArray);
            DPFPFeatureSet features = extractFeatures(sample, DPFPDataPurpose.DATA_PURPOSE_VERIFICATION);

//This is for matching features and template
            DPFPVerification matcher = DPFPGlobal.getVerificationFactory().createVerification();
            DPFPVerificationResult result1 = matcher.verify(features, template);
            if (result1.isVerified()) {

                return "The fingerprint was VERIFIED.";

            } else {
                return "The fingerprint was NOT VERIFIED.";

            }

请帮我。

4

1 回答 1

0

您可以在这里做的最好的事情是不要将字节数组转换为字符串。如果将其保存在数据库中,则可以自动将其保存为字节数组(因为 blob 可以接受字节数组)。

你可以像这样插入它(只是一个例子)

PreparedStatement st=con.prepareStatement("INSERT INTO EMPLOYEE(employee_id,template)"+"values(?,?)");
st.setInt(1,23);
st.setBytes(2, enroller.getTemplate().serialize());

Statement st = con.createStatement();
ResultSet rec = st.executeQuery("SELECT * FROM EMPLOYEE WHERE EMPLOYEE_ID=3");

然后在访问模板时,对其进行反序列化(只需按照 sdk,我认为它在第 37 页左右)Onetouch java sdk ==== 链接

下面将提供一个示例。

while(rec.next()){
    blob = rec.getBlob("template");
    int blobLength = (int)blob.length();  
    blobAsBytes = blob.getBytes(1, blobLength);
}
templater.deserialize(blobAsBytes);         
verificator.setFARRequested(DPFPVerification.MEDIUM_SECURITY_FAR);
DPFPVerificationResult result = verificator.verify(fs, templater);
if (result.isVerified())
    System.out.print("The fingerprint was VERIFIED.");
于 2012-11-28T19:08:46.640 回答