Sign an encrypted pdf document

Hi.

I want to encrypt a document and then sign it. I use the code below.

// encription

//Instantiating PdfFileSecurity object

PdfFileSecurity fileSecurity = new PdfFileSecurity("test.pdf", "test_enc.pdf");

//Calling EncryptFile method to encrypt the PDF document

fileSecurity.EncryptFile("", "ownerpassword", PdfPrivilege.Copy | PdfPrivilege.Print, true);

// sign

Certificate certificate = new Aspose.Pdf.Kit.Certificate("qwe.pfx", "qwe");

PdfFileSignature pdfSign = new PdfFileSignature(certificate);

pdfSign.SignModel = Aspose.Pdf.Kit.PdfFileSignature.WindowsCertificate;

pdfSign.BindPdf("test_enc.pdf");

System.Drawing.Rectangle rect = new System.Drawing.Rectangle(100, 100, 200, 100);

pdfSign.Sign(1, "", "", "", false, rect);

pdfSign.CertificationLevel = PdfFileSignature.NotCertified;

pdfSign.Save("test_sign.pdf");

But result file has a signature only. The result file has not an encryption.

How can I use an encryption and signature together?

Hi Den,

I have reproduced the problem at my end and logged it as PDFKITNET-11580 in our issue tracking system. Our team will be looking into the matter and you’ll be updated via this forum once the issue is resolved.

We’re sorry for the inconvenience.
Regards,

The issues you have found earlier (filed as 11580) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.