开发者社区> 问答> 正文

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

我正在尝试使用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);
           }
       }
   }

展开
收起
垚tutu 2019-12-04 17:16:45 546 0
0 条回答
写回答
取消 提交回答
问答排行榜
最热
最新

相关电子书

更多
Spring Cloud Alibaba - 重新定义 Java Cloud-Native 立即下载
The Reactive Cloud Native Arch 立即下载
JAVA开发手册1.5.0 立即下载