2
1
mirror of https://github.com/qpdf/qpdf.git synced 2025-02-02 11:58:25 +00:00
This commit is contained in:
Jay Berkenbilt 2011-08-10 20:57:52 -04:00
parent a42a4068b5
commit 9a1fad4077

View File

@ -472,6 +472,18 @@ QPDF::initializeEncryption()
} }
if (this->cf_file != this->cf_stream) if (this->cf_file != this->cf_stream)
{ {
// The issue for qpdf is that it can't tell the difference
// between an embedded file stream and a regular stream.
// Search for a comment containing cf_file. To fix this,
// we need files with encrypted embedded files and
// non-encrypted native streams and vice versa. Also if
// it is possible for them to be encrypted in different
// ways, we should have some of those too. In cases where
// we can detect whether a stream is encrypted or not, we
// might want to try to detecet that automatically in
// defense of possible logic errors surrounding detection
// of embedded file streams, unless that's really clear
// from the specification.
throw QPDFExc(qpdf_e_unsupported, this->file->getName(), throw QPDFExc(qpdf_e_unsupported, this->file->getName(),
"encryption dictionary", this->file->getLastOffset(), "encryption dictionary", this->file->getLastOffset(),
"This document has embedded files that are" "This document has embedded files that are"
@ -649,7 +661,9 @@ QPDF::decryptStream(Pipeline*& pipeline, int objid, int generation,
{ {
// NOTE: We should should use cf_file if this is an // NOTE: We should should use cf_file if this is an
// embedded file, but we can't yet detect embedded // embedded file, but we can't yet detect embedded
// file streams as such. // file streams as such. When fixing, search for all
// occurrences of cf_file to find a reference to this
// comment.
method = this->cf_stream; method = this->cf_stream;
} }
} }