2012-11-04 48 views
0

正試圖創建一個soap webservice方法來匹配使用digitalpersona one touch for windows sdk java edition的指紋。我從客戶端的一個applet捕獲功能集,並將其與服務器端的我的模板進行比較。但是我需要反序列化它並再次創建功能集,以便我可以將其與模板進行比較。無法反序列化使用DigitalPersona Sdk java版的功能集

我不知道如何重新創建功能設置,這樣我可以用它來驗證:

//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."; 

      } 

請幫助我。

回答

0

你可以在這裏做的最好的事情不是將bytearray轉換成字符串。如果你將它保存在數據庫中,你可以自動將它保存爲字節數組(因爲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.");