qq_40091266
转眼秋近
采纳率0%
2020-09-15 10:38

pdf获取电子签章信息报错java.security.NoSuchAlgorithmException: 2.16.840.1.101.3.4.2.1withRSA Signature not available

在获取pdf电子签章信息中报了个错,java.security.NoSuchAlgorithmException: 2.16.840.1.101.3.4.2.1withRSA Signature not available,签名不可用,百度了一些大佬的相关问题还是没有解决,有大佬知道怎么解决吗

 System.out.println("\n\nTestMGomez.pdf\n==============");
        setUp();
        try (InputStream resource = testOne.class.getResourceAsStream("TestMGomez.pdf")) {
            PdfReader reader = new PdfReader(resource);
            AcroFields acroFields = reader.getAcroFields();

            List<String> names = acroFields.getSignatureNames();
            for (String name : names) {
                System.out.println("Signature name: " + name);
                System.out.println("Signature covers whole document: " + acroFields.signatureCoversWholeDocument(name));
                PdfPKCS7 pk = acroFields.verifySignature(name);
                System.out.println("Subject: " + CertificateInfo.getSubjectFields(pk.getSigningCertificate()));
                System.out.println("Document verifies: " + pk.verify());

报错具体信息

Exception in thread "main" ExceptionConverter: java.security.NoSuchAlgorithmException: 2.16.840.1.101.3.4.2.1withRSA Signature not available
    at java.base/java.security.Signature.getInstance(Signature.java:267)
    at com.lowagie.text.pdf.PdfPKCS7.<init>(Unknown Source)
    at com.lowagie.text.pdf.AcroFields.verifySignature(Unknown Source)
    at com.lowagie.text.pdf.AcroFields.verifySignature(Unknown Source)
    at com.gx.publicserve.electronicSeal.service.testOne.testVerifyTestMGomez(testOne.java:41)
    at com.gx.publicserve.electronicSeal.service.testOne.main(testOne.java:21)
  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

1条回答

为你推荐