Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not decrypt XRef streams and "Encrypt" dictionary #214

Merged
merged 2 commits into from
Sep 25, 2018

Conversation

dennwc
Copy link

@dennwc dennwc commented Sep 24, 2018

According to spec, XRefs and "Encrypt" dictionary should never be decrypted.

Currently, the library attempts to decrypt them if trying to iterate over all objects in PDF, as described in #205.

This change records a reference to "Encrypt" dictionary in Decrypted map, so it won't be passed to decryption routine.

It also checks the Type field of PdfObjectStream and skips decryption if it's an XRef stream.

PR also includes a small refactoring for Encrypt and Decrypt function.

@gunnsth gunnsth merged commit 9c99362 into unidoc:master Sep 25, 2018
@dennwc dennwc deleted the decrypt_xref branch September 25, 2018 14:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants