Encryption Property

Definition

Namespace Broadside
Assembly Broadside.dll

Gets or sets how the saved file is encrypted with the standard security handler; null (the default) keeps the document's own encryption: an encrypted document is saved encrypted with its own key, an unencrypted one unencrypted.

public PdfEncryptionOptions? Encryption { get; set; }

Returns

Remarks

ISO 32000-2 §7.6. A document saved with encryption has a new encryption dictionary and file encryption key, and every string and stream is encrypted with it (§7.6.2), whatever encryption the document was read with; the old encryption dictionary is not written. Encrypted output is not deterministic: keys, salts and initialization vectors are random (§7.6.3, §7.6.4.4.7).

Keeping the document's own encryption re-encrypts every string and stream with the key it was opened with, under the encryption dictionary it was read with; ciphertext is never copied from the source file. A document that has an integrity MAC (ISO/TS 32004), or whose permissions require one, gets a new one computed over the whole saved file with its own key and KDFSalt; one opened without its file encryption key cannot, and is refused.

An incremental update (IncrementalUpdate) always keeps the document's encryption (§7.5.6: earlier revisions stay as written), so it refuses this option and RemoveEncryption.