mirror of
https://github.com/storytold/pdfcraft.git
synced 2026-10-31 13:37:35 -06:00
From review. Where the /Encrypt dictionary is stored, its object number or inline, is no longer part of the security comparison: the overlay takes it from the snapshot with its trailer, so undo past an optimized save still appends to that save. A full rewrite is left for an actual change of encryption: another dictionary or key, or below revision 5 a different first /ID. AES-256 keys don't depend on /ID, so it is no longer compared there, here or when reopening with a known key. overlay_changes_from now decides alone: Ok(false), changing nothing, when security differs, and save_bytes acts on that. A signed document refuses with SignedRewrite instead of being rewritten. The overlay also writes again any unchanged object packed in an object stream that the update replaces or frees. After an optimized save such an object read back as null from the next save.