You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@pdfbox.apache.org by Chris Bamford <cb...@mimecast.com> on 2015/01/15 18:02:02 UTC

Extraction of text from secured PDFs throws runtime exception

Hi

I recently noticed the following runtime exception in my application when trying to extract text from secured PDFs:


java.lang.VerifyError: (class: org/bouncycastle/cms/CMSSignedDataParser, method: replaceSigners signature: (Ljava/io/InputStream;Lorg/bouncycastle/cms/SignerInformationStore;Ljava/io/OutputStream;)Ljava/io/OutputStream;) Incompatible argument to function

I am using PDFBox 1.8.6 and I use these APIs:


document = PDDocument.load(is, true);

if (document.isEncrypted()) {

    PdfUtil.decryptPDFDoc(document);

}

...

I am assuming the error is occurring in the decryptPDFDoc() call?
My maven pom dependencies are:

<dependency>
    <groupId>org.bouncycastle</groupId>
    <artifactId>bcprov-jdk15</artifactId>
    <version>1.44</version>
</dependency>
<dependency>
    <groupId>org.bouncycastle</groupId>
    <artifactId>bcmail-jdk15</artifactId>
    <version>1.44</version>
</dependency>

Have I got this right?

Thanks for any pointers.

- Chris

Chris Bamford
Senior Developer
m: +44 7860 405292
p: +44 207 847 8700
w: www.mimecast.com
Address click here: www.mimecast.com/About-us/Contact-us/







Re: Extraction of text from secured PDFs throws runtime exception

Posted by Maruan Sahyoun <sa...@fileaffairs.de>.
Hi,

you can find the pom.xml used for the 1.8.6 release at http://svn.apache.org/viewvc/pdfbox/tags/1.8.6/pdfbox/pom.xml?view=markup to verify your settings.

BR
Maruan

Am 15.01.2015 um 18:02 schrieb Chris Bamford <cb...@mimecast.com>:

> 
> Hi 
> 
> 
> Chris Bamford	m: +44 7860 405292	w: www.mimecast.com
> Senior Developer	 p: +44 207 847 8700	Address click here
> 
>  	
> 
> 
> 
> 
> 
> 
> 
> 
> I recently noticed the following runtime exception in my application when trying to extract text from secured PDFs:
> 
> java.lang.VerifyError: (class: org/bouncycastle/cms/CMSSignedDataParser, method: replaceSigners signature: (Ljava/io/InputStream;Lorg/bouncycastle/cms/SignerInformationStore;Ljava/io/OutputStream;)Ljava/io/OutputStream;) Incompatible argument to function
> 
> I am using PDFBox 1.8.6 and I use these APIs:
> 
> document = PDDocument.load(is, true); 
> if (document.isEncrypted()) {
>     PdfUtil.decryptPDFDoc(document);
> }
> ...
> 
> I am assuming the error is occurring in the decryptPDFDoc() call?  
> My maven pom dependencies are:
> <dependency>
>     <groupId>org.bouncycastle</groupId>
>     <artifactId>bcprov-jdk15</artifactId>
>     <version>1.44</version>
> </dependency>
> <dependency>
>     <groupId>org.bouncycastle</groupId>
>     <artifactId>bcmail-jdk15</artifactId>
>     <version>1.44</version>
> </dependency>
> 
> Have I got this right?
> 
> Thanks for any pointers.
> 
> - Chris
> 


Re: Extraction of text from secured PDFs throws runtime exception

Posted by Chris Bamford <cb...@mimecast.com>.
Thanks Tilman - I'll try your suggestions.
           
Chris Bamford
m: +44 7860 405292
www.mimecast.com
 
Mimecast
CityPoint
One Ropemaker Street, London, EC2Y 9AW
+44 (0) 207 847 8700
             

On 15 Jan 2015, at 17:45, Tilman Hausherr <TH...@t-online.de>> wrote:

Hi,

always use the latest version of PDFBox, which is 1.8.8.

I don't know what happens in "PdfUtil.decryptPDFDoc". The correct call
is openProtection().

Tilman         
        
Disclaimer

cbamford@mimecast.com sent at 2015-01-15 17:59:19 is confidential and may be legally privileged. It is intended solely for use by users@pdfbox.apache.org and others authorized to receive it. If you are not users@pdfbox.apache.org
you are hereby notified that any disclosure, copying, distribution or taking action in reliance of the contents of this information is strictly prohibited and may be unlawful.

Mimecast Ltd. is a company registered in England and Wales with the company number 4698693 VAT No. GB 123 4197 34
Registered Office: CityPoint, One Ropemaker Street, Moorgate, London, EC2Y 9AW

This email message has been scanned for viruses by Mimecast. Mimecast delivers a complete managed email solution from a single web based platform. For more information please visit www.mimecast.com

mcst2013



Re: Extraction of text from secured PDFs throws runtime exception

Posted by Tilman Hausherr <TH...@t-online.de>.
Hi,

always use the latest version of PDFBox, which is 1.8.8.

I don't know what happens in "PdfUtil.decryptPDFDoc". The correct call 
is openProtection().

Tilman


Am 15.01.2015 um 18:02 schrieb Chris Bamford:
>
> Hi
>
>
> Chris Bamford 	m: +44 7860 405292 	w: www.mimecast.com 
> <http://www.mimecast.com/>
> Senior Developer 	p: +44 207 847 8700 	Address click here 
> <http://www.mimecast.com/About-us/Contact-us/>
> ------------------------------------------------------------------------
> http://www.mimecast.com 
> <https://serviceB.mimecast.com/mimecast/click?account=C1A1&code=ffa3b3bfde3400d0d05f16917232f20a> 
>
>
> 	
> 	
> LinkedIn 
> <https://serviceB.mimecast.com/mimecast/click?account=C1A1&code=40f4961a022ce0e939ee090e8014d927> 
>
>
> 	
> YouTube 
> <https://serviceB.mimecast.com/mimecast/click?account=C1A1&code=69396c32e7aa099609ed860443d9bbe8> 
>
>
> 	
> Facebook 
> <https://serviceB.mimecast.com/mimecast/click?account=C1A1&code=1f9ba08b644cdd0edec3322be6312618> 
>
>
> 	
> Blog 
> <https://serviceB.mimecast.com/mimecast/click?account=C1A1&code=0fcd5601a0dd01d34f18b525b9219a0d> 
>
>
> 	
> Twitter 
> <https://serviceB.mimecast.com/mimecast/click?account=C1A1&code=564d8f1dcd711b82b39a647d5e991247> 
>
>
>
>
>
> I recently noticed the following runtime exception in my application 
> when trying to extract text from secured PDFs:
>
> java.lang.VerifyError: (class: org/bouncycastle/cms/CMSSignedDataParser, method: replaceSigners signature: (Ljava/io/InputStream;Lorg/bouncycastle/cms/SignerInformationStore;Ljava/io/OutputStream;)Ljava/io/OutputStream;) Incompatible argument to function
>
> I am using PDFBox 1.8.6 and I use these APIs:
>
>     document = PDDocument.load(is,true);
>
>     if(document.isEncrypted()) {
>
>          PdfUtil.decryptPDFDoc(document);
>
>     }
>
>     ...
>
>
> I am assuming the error is occurring in the decryptPDFDoc() call?
> My maven pom dependencies are:
>
>     <dependency>
>          <groupId>org.bouncycastle</groupId>
>          <artifactId>bcprov-jdk15</artifactId>
>          <version>1.44</version>
>     </dependency>
>     <dependency>
>          <groupId>org.bouncycastle</groupId>
>          <artifactId>bcmail-jdk15</artifactId>
>          <version>1.44</version>
>     </dependency>
>
>
> Have I got this right?
>
> Thanks for any pointers.
>
> - Chris
>