You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@pdfbox.apache.org by Balaji Venkatamohan <bv...@tibco.com> on 2014/08/18 23:33:48 UTC

How to decrypt a PDF document when supplied an owner password

I want to know if PdfBox provides an option to decrypt a PDF document given
its owner password and not its user password?

I use :

DecryptionMaterial decryptionMaterial = new
StandardDecryptionMaterial("owner_password");
document.openProtection(decryptionMaterial);

I searched the net but could not find a matching issue. If it is a repeat
question and if there already exists a solution to this, please provide me
the link to the issue.

Thanks,
Balaji

Re: How to decrypt a PDF document when supplied an owner password

Posted by Balaji Venkatamohan <bv...@tibco.com>.
Hi Andreas,

Thank you for your reply. I have tried using

document.decrypt("ownerORuser_password");

in my code. The above API call works if we provide the user password to
decrypt an encrypted PDF but when I give the owner password for the same
PDF, the API is not able to validate the password correctly and it never
recognizes the owner password. When I try opening that PDF from the file
system, the owner password and the user password work.

Thanks,
Balaji


On Tue, Aug 19, 2014 at 3:07 AM, Andreas Lehmkühler <an...@lehmi.de>
wrote:

> Hi,
>
> > Balaji Venkatamohan <bv...@tibco.com> hat am 18. August 2014 um 23:33
> > geschrieben:
> >
> >
> > I want to know if PdfBox provides an option to decrypt a PDF document
> given
> > its owner password and not its user password?
> >
> > I use :
> >
> > DecryptionMaterial decryptionMaterial = new
> > StandardDecryptionMaterial("owner_password");
> > document.openProtection(decryptionMaterial);
> >
> > I searched the net but could not find a matching issue. If it is a repeat
> > question and if there already exists a solution to this, please provide
> me
> > the link to the issue.
> You should simply use something like the following:
>
> document.decrypt("owner_password");
>
> > Thanks,
> > Balaji
>
> BR
> Andreas Lehmkühler
>

Re: How to decrypt a PDF document when supplied an owner password

Posted by Andreas Lehmkühler <an...@lehmi.de>.
Hi,

> Balaji Venkatamohan <bv...@tibco.com> hat am 18. August 2014 um 23:33
> geschrieben:
>
>
> I want to know if PdfBox provides an option to decrypt a PDF document given
> its owner password and not its user password?
>
> I use :
>
> DecryptionMaterial decryptionMaterial = new
> StandardDecryptionMaterial("owner_password");
> document.openProtection(decryptionMaterial);
>
> I searched the net but could not find a matching issue. If it is a repeat
> question and if there already exists a solution to this, please provide me
> the link to the issue.
You should simply use something like the following:

document.decrypt("owner_password");

> Thanks,
> Balaji

BR
Andreas Lehmkühler