mirror of
https://github.com/qpdf/qpdf.git
synced 2024-12-22 10:58:58 +00:00
Add optional /Length key in crypt filter dictionary
This commit is contained in:
parent
a3576a7359
commit
eae8370cd9
@ -1,5 +1,9 @@
|
||||
2013-06-14 Jay Berkenbilt <ejb@ql.org>
|
||||
|
||||
* Add /Length key to crypt filter dictionary for encrypted files.
|
||||
This key is optional, but some version of MacOS reportedly fail to
|
||||
open encrypted PDF files without this key.
|
||||
|
||||
* Bug fix: properly handle object stream generation when the
|
||||
original file has some compressible objects with generation != 0.
|
||||
|
||||
|
@ -726,8 +726,12 @@ QPDFWriter::setEncryptionParametersInternal(
|
||||
std::string method = (this->encrypt_use_aes
|
||||
? ((V < 5) ? "/AESV2" : "/AESV3")
|
||||
: "/V2");
|
||||
// The PDF spec says the /Length key is optional, but the PDF
|
||||
// previewer on some versions of MacOS won't open encrypted
|
||||
// files without it.
|
||||
encryption_dictionary["/CF"] =
|
||||
"<< /StdCF << /AuthEvent /DocOpen /CFM " + method + " >> >>";
|
||||
"<< /StdCF << /AuthEvent /DocOpen /CFM " + method +
|
||||
" /Length " + std::string((V < 5) ? "16" : "32") + " >> >>";
|
||||
}
|
||||
|
||||
this->encrypted = true;
|
||||
|
@ -327,7 +327,7 @@ endobj
|
||||
<< /Dest [ 30 0 R /XYZ null null null ] /Parent 73 0 R /Title <0e1c2a38465462707e8c9aa8b6c4d2e04e0071f73ffb55e63fee8c296c57a5116ad91676f573b1c2fe59aca102ad3421cc50bd84f88f518cd8bbd9962c7a59d0> /Type /Outline >>
|
||||
endobj
|
||||
79 0 obj
|
||||
<< /CF << /StdCF << /AuthEvent /DocOpen /CFM /AESV2 >> >> /EncryptMetadata false /Filter /Standard /Length 128 /O <36451bd39d753b7c1d10922c28e6665aa4f3353fb0348b536893e3b1db5c579b> /P -4 /R 4 /StmF /StdCF /StrF /StdCF /U <e4d8eb0d7c43579866926fec0eab59020122456a91bae5134273a6db134c87c4> /V 4 >>
|
||||
<< /CF << /StdCF << /AuthEvent /DocOpen /CFM /AESV2 /Length 16 >> >> /EncryptMetadata false /Filter /Standard /Length 128 /O <36451bd39d753b7c1d10922c28e6665aa4f3353fb0348b536893e3b1db5c579b> /P -4 /R 4 /StmF /StdCF /StrF /StdCF /U <e4d8eb0d7c43579866926fec0eab59020122456a91bae5134273a6db134c87c4> /V 4 >>
|
||||
endobj
|
||||
xref
|
||||
0 80
|
||||
@ -413,5 +413,5 @@ xref
|
||||
0000014817 00000 n
|
||||
trailer << /Info 2 0 R /Root 1 0 R /Size 80 /ID [<66d36a30a97e0f16f39955c6221e0c2a><31415926535897932384626433832795>] /Encrypt 79 0 R >>
|
||||
startxref
|
||||
15129
|
||||
15140
|
||||
%%EOF
|
||||
|
@ -306,7 +306,7 @@ endobj
|
||||
<< /Dest [ 30 0 R /XYZ null null null ] /Parent 73 0 R /Title <0e1c2a38465462707e8c9aa8b6c4d2e0a57e63f459f8a8428dfc859f799038f972379574e01ef823841a76dbefaa14665223960437217436968f6261cc32feb9> /Type /Outline >>
|
||||
endobj
|
||||
79 0 obj
|
||||
<< /CF << /StdCF << /AuthEvent /DocOpen /CFM /AESV2 >> >> /Filter /Standard /Length 128 /O <36451bd39d753b7c1d10922c28e6665aa4f3353fb0348b536893e3b1db5c579b> /P -4 /R 4 /StmF /StdCF /StrF /StdCF /U <32c27288b9ec6a4fab94e6188828595c0122456a91bae5134273a6db134c87c4> /V 4 >>
|
||||
<< /CF << /StdCF << /AuthEvent /DocOpen /CFM /AESV2 /Length 16 >> >> /Filter /Standard /Length 128 /O <36451bd39d753b7c1d10922c28e6665aa4f3353fb0348b536893e3b1db5c579b> /P -4 /R 4 /StmF /StdCF /StrF /StdCF /U <32c27288b9ec6a4fab94e6188828595c0122456a91bae5134273a6db134c87c4> /V 4 >>
|
||||
endobj
|
||||
xref
|
||||
0 80
|
||||
@ -392,5 +392,5 @@ xref
|
||||
0000014404 00000 n
|
||||
trailer << /Info 2 0 R /Root 1 0 R /Size 80 /ID [<66d36a30a97e0f16f39955c6221e0c2a><31415926535897932384626433832795>] /Encrypt 79 0 R >>
|
||||
startxref
|
||||
14693
|
||||
14704
|
||||
%%EOF
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue
Block a user