Spire.PDF is a professional PDF library applied to creating, writing, editing, handling and reading PDF files without any external dependencies. Get free and professional technical support for Spire.PDF for .NET, Java, Android, C++, Python.

Mon Sep 18, 2023 4:43 pm

I'm trying to decrypt a PDF file but I'm getting the error message:

"The Permission password is invalid."

What's strange is that we can load the file with the password but when decrypting this error is triggered:

PdfDocument PDFEncriptado = new PdfDocument(@"FaturaCriptografada.pdf", "15511");
PDFEncriptado.Security.Encrypt(String.Empty, String.Empty, PdfPermissionsFlags.Default, PdfEncryptionKeySize.Key128Bit, "15511");

I'm waiting for the analysis. Thank you for your attention,

Campêlo

RuiBarbosa
 
Posts: 19
Joined: Thu Apr 18, 2019 12:23 pm

Tue Sep 19, 2023 6:46 am

Hi,

Thank you for your inquiry.
I used the latest version of Spire.Pdf for .Net 9.9.3 to test the code you provided, but I didn’t reproduce your issue. Did you use the latest version of Spire.Pdf for .Net? If not, please use the latest version to test again. If the issue still exists, please offer the following informations to help us do further investigation. Thank you in advance.
1)Application type, such as Console App, .NET Framework 4.8.
2)Your test environment, such as OS info (E.g. Windows 7, 64-bit).

Sincerely,
Ula
E-iceblue support team
User avatar

Ula.wang
 
Posts: 282
Joined: Mon Aug 07, 2023 1:38 am

Wed Sep 20, 2023 5:28 pm

Ula,

thank you for the feedback. The environment we are working in is:

- Spire PDF V 8.1.4
- Framework 4.5.2
- Windows 10

We did a test with version 9.9.3. Everything worked correctly.

But their situations appeared:

- We are receiving a warning message (Print01.png attached):
'PdfDocument.Security' is obsolete: 'This property may be removed in the future. please use methods (Encrypt(PdfSecurityPolicy SecurityPolicy), Decrypt().) and SecurityPolicy property instead.

We didn't find any reference to them in the API Reference:
https://www.e-iceblue.com/apireference/ ... ncrypt.htm
It refers to version 7.10.0.0

- Another problem is that the PDF now has the top message "Evaluation Warnig: The document was created with Spire.PDF for .NET." (726346.pdf attached)

We need a solution for version 8.7.

Thank you for your attention.

Campêlo

RuiBarbosa
 
Posts: 19
Joined: Thu Apr 18, 2019 12:23 pm

Thu Sep 21, 2023 7:45 am

Hi,

Thank you for your feedback.
After further investigation, it was found that the open password for the document you provided is "15511", but the permission password is not "15511". In the version of Spire.Pdf for .Net 8.7.9, the last parameter of the Encrypt() method should be the permission password. You entered the open password in your code, so an exception will be thrown. Please refer to the following image to modify the code and test again.
lQLPJw6LUdBwUnTNAXvNA-2w-C85kqnO6sYE_zoO4sC4AQ_1005_379.png

Additionally, your license is no longer valid for the latest version of Spire.Pdf for .Net 9.9.3, so there is a red warning message in the result document. And in the latest version, we have made adjustments to the document encrypt code.
I put the complete code below for your referenece:
Code: Select all
  PdfDocument PDFEncriptado = new PdfDocument();
            PDFEncriptado.LoadFromFile(@"C:\\Users\\kylin\\Downloads\\FaturaCriptografada\\FaturaCriptografada.pdf", "15511");
            PDFEncriptado.Decrypt();
 PDFEncriptado.SaveToFile(@"E:\34598\1.pdf", FileFormat.PDF);


Sincerely,
Ula
E-iceblue support team
User avatar

Ula.wang
 
Posts: 282
Joined: Mon Aug 07, 2023 1:38 am

Thu Sep 21, 2023 4:15 pm

Ula, thank you for your feedback.

We don't have the permission password. Using version 9.9.3 would be perfect for us. We had to resolve the issue in another way.

Let's talk to the board to analyze the SpirePDF upgrade.

RuiBarbosa
 
Posts: 19
Joined: Thu Apr 18, 2019 12:23 pm

Fri Sep 22, 2023 6:07 am

Hi,

Thank you for your feedback.
Currently, the new decryption method Decrpt() in Spire.Pdf for .Net 9.9.3 doesn’t require a permission password to decrypt documents, which is a bug. Our product strictly follow Adobe's specifications and require a permission password when decrypting documents. Therefore, this bug will be fixed in subsequent new versions. Once this bug is fixed, permission password must be required to when decrypting pdf document. If you need a renewal to solve your current problem, it is means that you will only be able to use Spire.Pdf for .Net 9.9.3 in the future.This is unfair to you, and we hope you will carefully consider the renewal issue.

Sincerely,
Ula
E-iceblue support team
User avatar

Ula.wang
 
Posts: 282
Joined: Mon Aug 07, 2023 1:38 am

Return to Spire.PDF

cron