We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Attached document does not raise "Invalid Password" when Document object is constructed

With the attached document, if I run the following code:

string filePath = @"[PATH]\test.pdf";
Aspose.Pdf.Document doc = new Aspose.Pdf.Document(filePath);

no “Invalid password” exception is raised. However, if I open this file in Adobe Acrobat or Reader I am prompted with an Open password.

Hi,


Thanks for contacting support.

I have tested the scenario and have observed the same behavior. For the sake of further investigation, I have logged this scenario as PDFNEWNET-36320 in our issue tracking system. We will further
look into the details of this problem and will keep you updated on the status
of correction. Please be patient and spare us little time. We are sorry for
this inconvenience.

Hi,


Thanks for your patience.

We have further investigated the issue PDFNEWNET-36320 reported earlier and as per our observations, it does not seem to be a bug in Aspose.Pdf for .NET API. PDF only encrypts streams and strings objects, so the document is still leaking useful information in clear-text, such as pages count information in this case. What pdf reference says about encryption:

“Encryption applies to all strings and streams in the document’s PDF file, but not to other object types such as integers and boolean values, which are used primarily to convey information about the document’s structure rather than its content. Leaving these values unencrypted allows random access to the objects within a document, whereas encrypting the strings and streams protects the document’s substantive contents…”

Thank you for your response Nayyer. Further questions on this thread:


1) I see a difference depending on the file I open. For example, the attached “Metadata Removal Test-Fifth.pdf” raises an exception but the “128-AES-.pdf” does not.

2) Also, if I use the Aspose.PDF.Facades.PDFInfo class then an exception is never raised.

Would you be able to explain the differences between the documents and classes?

Thanks
Freedom Solutions:
1) I see a difference depending on the file I open. For example, the attached "Metadata Removal Test-Fifth.pdf" raises an exception but the "128-AES-.pdf" does not.
Hi,

Thanks for sharing the resource files.

I have tested the scenario and have managed to reproduce the same problem. The information has been communicated to development team and they are further looking into this matter.

Freedom Solutions:
2) Also, if I use the Aspose.PDF.Facades.PDFInfo class then an exception is never raised.

As per my observations, when using following code lines, I am getting NullReferenceException - PdfFileInfo is not initialized. Use constructors with parameters or properties for initialization. (File: c:/pdftest/Metadata+Removal+Test-Fifth.pdf) (Reason: Invalid password) but no error is occurring when trying to open 128-AES.pdf file with this object.