0

我正在尝试使用数字角色 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);
           }
       }
   }
4

1 回答 1

0

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

JOptionPane.showMessageDialog(this,"指纹成功匹配 USERID"); }

于 2020-05-19T08:04:24.513 回答