Uploaded image for project: 'PDFBox'
  1. PDFBox
  2. PDFBOX-4662

ClassCastException: org.bouncycastle.asn1.DLTaggedObject cannot be cast to org.bouncycastle.asn1.DERTaggedObject

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.0.17
    • Fix Version/s: 2.0.18, 3.0.0 PDFBox
    • Component/s: Crypto
    • Labels:
      None

      Description

      I get this with the attached file:

      Exception in thread "main" java.lang.ClassCastException: org.bouncycastle.asn1.DLTaggedObject cannot be cast to org.bouncycastle.asn1.DERTaggedObject
      	at org.apache.pdfbox.examples.signature.cert.CertificateVerifier.extractOCSPURL(CertificateVerifier.java:397)
      	at org.apache.pdfbox.examples.signature.cert.CertificateVerifier.checkRevocations(CertificateVerifier.java:197)
      	at org.apache.pdfbox.examples.signature.cert.CertificateVerifier.verifyCertificate(CertificateVerifier.java:151)
      	at org.apache.pdfbox.examples.signature.ShowSignature.verifyCertificateChain(ShowSignature.java:901)
      

      Solution: replace DERTaggedObject with ASN1TaggedObject. The exception is related to a change in BC. The latest 2.0 branch doesn't have the problem, but it uses 1.60 while the trunk uses 1.63. The error doesn't happen with 1.62. The changes doesn't break the 2.0 branch so I'll change it there too, to avoid trouble for people who use 1.63 with the code. My impression of looking at the source code is that the difference between the two classes is in encoding, which we don't use.

        Attachments

        1. QV_RCA1_RCA3_CPCPS_V4_11.pdf
          994 kB
          Tilman Hausherr

          Activity

            People

            • Assignee:
              tilman Tilman Hausherr
              Reporter:
              tilman Tilman Hausherr
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: