Skip to main content

Secure a PDF

Protect a PDF with AES-256 passwords

Encrypt a PDF with AES-256 Standard security, set document-open and owner passwords, and review preservation evidence for the protected copy.

Practical steps

Create an AES-256 password-protected PDF

Set separate user and owner credentials, rewrite the document, and verify the protected output.

  1. SelectChoose one PDF that can be rewritten under the current security policy.
  2. ProtectEnter a document-open password and a separate owner password.
  3. VerifyCreate the AES-256 output and review encryption and preservation evidence.

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.