Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IText AllowAssembly and StandardEncryption

Tags:

c#

pdf

itext

I am attempting to digitally sign a pdf document while still allowing for the modification of annotations and allowing the adding and removing of pages using itextsharp, Version=4.1.6.0. Below is my current code:

var signatureStamper = PdfStamper.CreateSignature(pdfReader, memoryStream, '\0', null);
signatureStamper.SetEncryption(null, Encoding.UTF8.GetBytes(certificationBundle.Password), PdfWriter.ALLOW_PRINTING | PdfWriter.ALLOW_MODIFY_ANNOTATIONS | PdfWriter.AllowAssembly, PdfWriter.STANDARD_ENCRYPTION_128);

With this configuration however, I am still unable to add and remove pages. Am I Using PdfWriter.AllowAssembly incorrectly?

like image 275
jth41 Avatar asked May 06 '26 02:05

jth41


1 Answers

I am attempting to digitally sign a pdf document while still allowing for the modification of annotations and allowing the adding and removing of pages

Addition or removal of pages is never allowed for signed documents, cf. this stack overflow answer. At most you are allowed to do the following:

  • Adding signature fields

  • Adding or editing annotations

  • Supplying form field values

  • Digitally signing

like image 67
mkl Avatar answered May 07 '26 17:05

mkl



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!