Signature on encrypted documents results invalid signature

When signing a crypted document with privileges, the final document has an invalid signature. Adobe states “Document has been altered or corrupted since ist was signed”.

This question may bei connected to PDFJAVA-39851

Code Example:

import jpype.imports
jpype.startJVM(jpype.getDefaultJVMPath(), classpath='aspose-pdf-22.9-jdk16.jar')
Document = jpype.JClass("com.aspose.pdf.Document")
License = jpype.JClass("com.aspose.pdf.License")

PdfFileSignature = jpype.JClass("com.aspose.pdf.facades.PdfFileSignature")
PKCS7 = jpype.JClass("com.aspose.pdf.PKCS7")

pdflic = License()
pdflic.setLicense(jpype.JString("../Aspose.PDF.Java.lic"))

# Document with permissions and owner-passwort <secret>
pdf = Document('sign_example_with_priv.pdf', 'secret')
sig = PdfFileSignature(pdf)
pkcs = PKCS7("sign_example.pfx", "geheim")
sig.sign("signature1", pkcs)
sig.save('sign_example_with_priv_and_signed.pdf')
sig.close()

This topic has been moved to the related forum: Signature on encrypted documents results invalid signature - Free Support Forum - aspose.com