在Java中使用U验证指纹是数字角色

时间:2019-12-03 21:55:45

标签: java digital-persona-sdk

我正在尝试使用Digital Persona SDK验证指纹。我可以使用以下代码捕获并将模板保存到MySQL数据库,但是问题出在验证期间。当我尝试验证指纹时,总是显示失败。 这是注册和验证代码。我会发布注册代码,但是由于代码太长,stackoverflow不允许我


protected void process(DPFPSample sample) {
       super.process(sample);

       // Process the sample and create a feature set for the enrollment purpose.
       features = extractFeatures(sample, DPFPDataPurpose.DATA_PURPOSE_VERIFICATION);

       // Check quality of the sample and start verification if it's good
       if (features != null) {
           // Compare the feature set with our template
           DPFPVerificationResult result = verificator.verify(features, ((MainForm) getOwner()).getTemplate());
           // updateStatus(result.getFalseAcceptRate());
           if (result.isVerified()) {
               try {
                   DPFPTemplate templat = ((MainForm) getOwner()).getTemplate();
                   byte[] vrr = templat.serialize();

                   pst = con.prepareStatement("select fingerprint from accounts where fingerprint=?");
                   pst.setBytes(1, vrr);
                   rs = pst.executeQuery();
                   if (rs.next()) {
                       JOptionPane.showMessageDialog(this, "Fingerprint doesn't match the User ID", "Unable to Login", JOptionPane.ERROR_MESSAGE);

                   } else {
                       JOptionPane.showMessageDialog(this, "Fingerprint doesn't match the User ID", "Unable to Login", JOptionPane.ERROR_MESSAGE);

                   }

               } catch (SQLException e) {
               }
           } else {
               makeReport("The fingerprint was NOT VERIFIED.");
               JOptionPane.showMessageDialog(this, "The fingerprint was NOT VERIFIED.", "Verification Failed", JOptionPane.ERROR_MESSAGE);
           }
       }
   }

1 个答案:

答案 0 :(得分:0)

将语句编辑为-> if(rs.next){

JOptionPane.showMessageDialog(this,“ FIngerprint成功匹配USERID”); }