Mudrit
Reference

Encryption

OutputEncryption, Cipher, and Permissions — password-protecting the signed output

Part of mudrit-pdfsign

OutputEncryption re-encrypts the signed output (SignConfig::encrypt); it is unrelated to an already-encrypted input, which is a PdfReader concern. See the Encryption guide for the full input-vs-output walkthrough.

OutputEncryption

#[non_exhaustive], Clone. Debug hides both passwords, printing only the cipher and whether each is set.

Prop

Type

Constructors and methods

Prop

Type

OutputEncryption also implements From<&str> and From<String> (both call password(..)), so SignConfigBuilder::encrypt("newpw") works directly:

use mudrit_pdfsign::prelude::*;

// shorthand: a new password, AES-128, unrestricted
let cfg = SignConfig::builder()
    .place("F", [350, 60, 560, 160])?
    .encrypt("newpw")
    .build();

// full control
let cfg = SignConfig::builder()
    .place("F", [350, 60, 560, 160])?
    .encrypt(
        OutputEncryption::password("user")
            .owner_password("owner")
            .cipher(Cipher::Aes256)
            .permissions(Permissions::all().copy(false).modify(false)),
    )
    .build();
# Ok::<(), mudrit_pdfsign::Error>(())

Incompatible with PDF/A

OutputEncryption cannot be combined with SignConfig::pdfa — PDF/A forbids encryption in the document.

Cipher

#[non_exhaustive], Debug + Clone + Copy + PartialEq + Eq + Default.

Prop

Type

Permissions

PDF access permissions (ISO 32000-1 Table 22), enforced by the owner password — a viewer that opens with the user password honours these; the owner password lifts them. #[non_exhaustive], Debug + Clone + Copy. Default = Permissions::all().

Prop

Type

Presets and toggles

Prop

Type

use mudrit_pdfsign::Permissions;

let p = Permissions::all().print(true).copy(false).modify(false); // view + print only

Next

On this page