I m creating and signing pdf using c#,itextsharp.Now i m using this code for password protection.
Can someone tellme why is this happening?
string passprotectedfile = filename;
using (Stream input = new FileStream(signedfile, FileMode.Open, FileAccess.Read,
using (Stream output = new FileStream(passprotectedfile, FileMode.Create,
PdfReader reader = new PdfReader(input);
PdfEncryptor.Encrypt(reader, output, true, regno.ToString(), "",
The whole point of a digital signature is to ensure that nobody has tampered with the contents of the file. By adding a password you are modifying it so the digital signature that was applied is no longer valid and this is what the error message is telling you. You will need to resign the PDF file after modifying it.