Tilman Hausherr created PDFBOX-6218:
---------------------------------------

             Summary: org.bouncycastle.cms.CMSException: IOException reading 
content.
                 Key: PDFBOX-6218
                 URL: https://issues.apache.org/jira/browse/PDFBOX-6218
             Project: PDFBox
          Issue Type: Bug
            Reporter: Tilman Hausherr


The latest bouncy castle version 1.85 has a new "feature", it checks input for 
extra bytes so all signature tests fail because we don't know the real length 
of the signature, we write into an array of zero bytes which worked fine in the 
past.

It happened in this commit:
https://github.com/bcgit/bc-java/commit/ca74bb8e27fa75fa52fceec0c1553b25ce1d3192


org.bouncycastle.cms.CMSException: IOException reading content.
        at org.bouncycastle.cms.CMSUtils.readContentInfo(Unknown Source)
        at org.bouncycastle.cms.CMSSignedData.<init>(Unknown Source)
        at 
org.apache.pdfbox.examples.pdmodel.TestCreateSignature.testCRL(TestCreateSignature.java:876)
        at java.base/java.lang.reflect.Method.invoke(Method.java:566)
        at 
java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290)
        at 
java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1020)
        at 
java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1656)
        at 
java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1594)
        at 
java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:183)
Caused by: java.io.IOException: Extra data detected in stream
        at org.bouncycastle.asn1.ASN1Primitive.fromByteArray(Unknown Source)
        ... 9 more

I was able to find one workaround for some of the cases, which is to wrap the 
byte array into a ByteArrayInputStream, e.g. in testCRL().



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to