aboutsummaryrefslogtreecommitdiffstats
path: root/libqpdf/QPDF_encryption.cc
diff options
context:
space:
mode:
authorJay Berkenbilt <ejb@ql.org>2021-02-06 22:25:10 +0100
committerJay Berkenbilt <ejb@ql.org>2021-02-06 23:08:41 +0100
commite076c9bf084ba5f90f52d829255e4ef04e3a8031 (patch)
tree2e2fb760c89cf04dd7eda0d2c5044f46925c6fc1 /libqpdf/QPDF_encryption.cc
parentac2b3b96e163c6ef98b708c6392a7e51538dd1cf (diff)
downloadqpdf-e076c9bf084ba5f90f52d829255e4ef04e3a8031.tar.zst
Remove erroneous handling of /EFF for stream decryption
I thought /EFF was supposed to be used as a default for decrypting embedded file streams, but actually it's supposed to be advice to a conforming writer about handling new ones. This makes sense since the findAttachmentStreams code, which is not actually needed, was never right.
Diffstat (limited to 'libqpdf/QPDF_encryption.cc')
-rw-r--r--libqpdf/QPDF_encryption.cc25
1 files changed, 15 insertions, 10 deletions
diff --git a/libqpdf/QPDF_encryption.cc b/libqpdf/QPDF_encryption.cc
index 00bd697e..2ff48df9 100644
--- a/libqpdf/QPDF_encryption.cc
+++ b/libqpdf/QPDF_encryption.cc
@@ -1022,6 +1022,20 @@ QPDF::initializeEncryption()
this->m->encp->cf_string = interpretCF(this->m->encp, StrF);
if (EFF.isName())
{
+ // qpdf does not use this for anything other than
+ // informational purposes. This is intended to instruct
+ // conforming writers on which crypt filter should be used
+ // when new file attachments are added to a PDF file, but
+ // qpdf never generates encrypted files with non-default
+ // crypt filters. Prior to 10.2, I was under the mistaken
+ // impression that this was supposed to be used for
+ // decrypting attachments, but the code was wrong in a way
+ // that turns out not to have mattered because no writers
+ // were generating files the way I was imagining. Still,
+ // providing this information could be useful when looking
+ // at a file generated by something else, such as Acrobat
+ // when specifying that only attachments should be
+ // encrypted.
this->m->encp->cf_file = interpretCF(this->m->encp, EFF);
}
else
@@ -1224,7 +1238,6 @@ QPDF::decryptStream(PointerHolder<EncryptionParameters> encp,
QPDF& qpdf_for_warning, Pipeline*& pipeline,
int objid, int generation,
QPDFObjectHandle& stream_dict,
- bool is_attachment_stream,
std::vector<PointerHolder<Pipeline> >& heap)
{
std::string type;
@@ -1296,15 +1309,7 @@ QPDF::decryptStream(PointerHolder<EncryptionParameters> encp,
}
else
{
- if (is_attachment_stream)
- {
- QTC::TC("qpdf", "QPDF_encryption attachment stream");
- method = encp->cf_file;
- }
- else
- {
- method = encp->cf_stream;
- }
+ method = encp->cf_stream;
}
}
use_aes = false;