Aspose.PDF for .NET now includes a dedicated Security plugin: a single class that encrypts a PDF with a password and a permission set, or decrypts one, without touching the rest of the full Aspose.PDF API surface.

What’s New

Security lives in the Aspose.Pdf.LowCode namespace alongside the other LowCode plugins. Encrypting a document takes a user password, an owner password, a DocumentPrivilege permission set, and a CryptoAlgorithm – RC4x40, RC4x128, AESx128, and AESx256 are all directly supported, each individually confirmed to produce a valid encrypted file. Decrypting needs only the owner password.

Why It Matters

  • Restrict who can open a confidential PDF, by requiring a password to view it at all.
  • Allow a document to be opened and read while still blocking printing or copying, by combining a password with DocumentPrivilege’s individual switches such as AllowPrint and AllowCopy.
  • Remove password protection from a PDF you control, once it no longer needs to be restricted.

A Quick Look

using Aspose.Pdf.LowCode;
using Aspose.Pdf.Facades;

var security = new Security();
var encryptOptions = new EncryptionOptions(
    "userPassword123", "ownerPassword456",
    DocumentPrivilege.ForbidAll, CryptoAlgorithm.AESx256);

encryptOptions.AddInput(new FileDataSource("input.pdf"));
encryptOptions.AddOutput(new FileDataSource("encrypted.pdf"));
security.Process(encryptOptions);

Learn More

See the full Security Developer Guide and KB article for advanced permission sets and stream-based processing, or get the plugin from the Security product page.

More in this category