Signing secured pdf document produced Document is altered or corrupted

Signing of secured document - pdf document with only owner’s password - produced invalid signature from the perspective of Adobe Reader. Tried same scenario with another library for pdf manipulation an that was not a case…
It seems similar to

And in release log of 22.8 found that issue has been solved but not for this case.

Here are the file sif you want to reproduce issue:

source file - secured_owners_pass.pdf
output file - aspose_sign.pdf
pfx file is in demo.zip
and password for pfx: demoTest1234

adobeReaderSignInvalid.PNG (15.3 KB)
aspose_sign.pdf (14.7 KB)
secured_owners_pass.pdf (5.5 KB)demo.zip (2.6 KB)

and here are the code lines:

String sourceFile = “src/test/resources/docs/secured_owners_pass.pdf”;
String pfx = “src/test/resources/docs/ks/demo.pfx”;
String pfxPassword = “demoTest1234”;
String outputFile = “src/test/resources/docs/aspose_sign.pdf”;

  InputStream licenseStream = getClass().getClassLoader().getResourceAsStream("Aspose.PDF.Java.lic");
  License license = new License();
  license.setLicense(licenseStream);

  PdfFileSignature pdfSign = new PdfFileSignature();
  pdfSign.bindPdf(sourceFile);

  Rectangle rect = new Rectangle(100, 100, 200, 100);
  PKCS7 signature = new PKCS7(pfx, pfxPassword);

  signature.setShowProperties(false);
  pdfSign.sign(1, "", "", "", true, rect, signature);

  pdfSign.save(outputFile);

Thanks in advance!

@irakic01

Can you please share which version of the Aspose.PDF API are you using? Have you tried using the latest version i.e. 22.10?

Thanks for quick reply, so we are using version 22.10.1 :

com.aspose
aspose-pdf
22.10.1

but with temporary license :

20221223
This is a temporary license for non-commercial use only and it will expire on 2022-12-23
3.0

I suppose that has not any impact on signing functionality?

@irakic01

Another ticket as PDFJAVA-42287 has been logged in our issue tracking system for further analysis of this case. We will further look into its details and keep you posted with the status of its correction. Please be patient and spare us some time.

We are sorry for the inconvenience.

The issues you have found earlier (filed as PDFJAVA-42287) have been fixed in Aspose.PDF for Java 23.10.