Password protection uses the PDF Standard security handler. The user password opens the document; the owner password controls privileged changes and should be stored separately from the delivered file.
Protect from .NET
using OfficeIMO.Pdf;
PdfDocument source = PdfDocument.Open("statement.pdf");
var encryption = new PdfStandardEncryptionOptions("reader-password") {
OwnerPassword = "owner-password",
Algorithm = PdfStandardEncryptionAlgorithm.Aes256
};
PdfSecurityMutationResult result = source.Security.Encrypt(encryption);
File.WriteAllBytes("statement.protected.pdf", result.Pdf);
Console.WriteLine(result.PreservationReport.Summary);
The mutation result exposes whether the output is encrypted and whether the rewrite preserved the expected document structure. Applications should handle passwords through their normal secret-management policy, not source code or logs.
Encryption is not signing
Password protection does not identify the publisher, validate document integrity through a certificate, or timestamp a revision. Use the cryptographic signing and validation APIs through OfficeIMO.Pdf and OfficeIMO.Security when the workflow requires those guarantees.