[poppler] [RFC] Add option to strip encryption
Adam Reichold
adam.reichold at t-online.de
Tue Sep 1 14:34:10 PDT 2015
Hello again,
Am 01.09.2015 um 00:16 schrieb Albert Astals Cid:
> El Dissabte, 25 de juliol de 2015, a les 14:26:48, Adam Reichold va escriure:
>> Hello,
>>
>> the attached patch adds an option to strip the encryption from a
>> document by doing a complete rewrite but ignoring the original
>> encryption parameters and removing the encryption entry form the trailer
>> dictionary. It also exposes this via the two Qt frontends.
>>
>> This might be useful for a separate command-line utility but for now my
>> primary use case is submitting a rewritten but unencrypted document to
>> CUPS for printing instead of converting to PostScript.
>
> Pushed.
>
I am very sorry, but during further testing, I noticed that the raw
stream copying done in "PDFDoc::writeObject" breaks documents generated
using this flag. It seems this yields the encrypted data being written
instead of the decrypted data.
The attached patch tries to solve this by passing the "stripEncryption"
flag to the "writeObject" method to suppress the raw stream copying,
which however yields a horribly large patch for what is effectively a
single-line change due to the recursive calls to "writeObject" from
various places.
While this changes does yield correctly decrypted files which CUPS
prints properly, it also "strips" various other stream filters like
"Flate" yielding much larger documents. I think the better solution
would be to reliably detect this situation within "writeObject" to
suppress the raw stream copying on a case-by-case basis, but I have not
yet managed to implement this. I would be grateful for any advice on how
to do this.
Best regards, Adam.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: disable-raw-stream-copy.diff
Type: text/x-patch
Size: 13385 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/poppler/attachments/20150901/fa4a2498/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: OpenPGP digital signature
URL: <http://lists.freedesktop.org/archives/poppler/attachments/20150901/fa4a2498/attachment.sig>
More information about the poppler
mailing list