2
1
mirror of https://github.com/qpdf/qpdf.git synced 2024-05-29 00:10:54 +00:00

use StdCF to make adobe reader happy; handle EncryptMetadata properly when reading

git-svn-id: svn+q:///qpdf/trunk@817 71b93d88-0707-0410-a8cf-f5a4172ac649
This commit is contained in:
Jay Berkenbilt 2009-10-18 02:26:09 +00:00
parent b873dc9c59
commit 67e353e4e4
3 changed files with 9 additions and 6 deletions

4
TODO
View File

@ -55,12 +55,12 @@
- figure out a way to test crypt filters defined on a stream
- test extraction of metadata with and without encrypted metadata
- would be nice to test strings and streams with different
encryption types, but without sample data, we'd have to write
them ourselves which is not that useful
- figure out why xpdf can open my files but not acroread
- figure out how to look at the metadata so I can tell whether
/EncryptMetadata is working the way it's supposed to

View File

@ -363,11 +363,14 @@ QPDFWriter::setEncryptionParametersInternal(
}
if (V == 4)
{
encryption_dictionary["/StmF"] = "/CF1";
encryption_dictionary["/StrF"] = "/CF1";
// The spec says the value for the crypt filter key can be
// anything, and xpdf seems to agree. However, Adobe Reader
// won't open our files unless we use /StdCF.
encryption_dictionary["/StmF"] = "/StdCF";
encryption_dictionary["/StrF"] = "/StdCF";
std::string method = (this->encrypt_use_aes ? "/AESV2" : "/V2");
encryption_dictionary["/CF"] =
"<< /CF1 << /AuthEvent /DocOpen /CFM " + method + " >> >>";
"<< /StdCF << /AuthEvent /DocOpen /CFM " + method + " >> >>";
}
this->encrypted = true;

View File

@ -612,7 +612,7 @@ QPDF::decryptStream(Pipeline*& pipeline, int objid, int generation,
// XXX What about embedded file streams?
}
use_aes = false;
switch (this->cf_stream)
switch (method)
{
case e_none:
return;