diff options
author | Masamichi Hosoda <trueroad@trueroad.jp> | 2019-09-26 16:36:14 +0200 |
---|---|---|
committer | Jay Berkenbilt <ejb@ql.org> | 2019-10-22 22:16:16 +0200 |
commit | 5e0ba126871c57a8a688b36614f2b8d78c2675b3 (patch) | |
tree | 3fe97fa23c0702e592d4a20c52b7da06cda8c0b5 /libqpdf/QPDFWriter.cc | |
parent | 3094955deeb2e8d3a9e325c3a47baffd6aea57ab (diff) | |
download | qpdf-5e0ba126871c57a8a688b36614f2b8d78c2675b3.tar.zst |
Fix /Contents value representation in a signature dictionary
Table 8.93 "Entries in a signature dictionary" in PDF 1.5 reference
describes that the value of Contents entry is a hexadecimal string
representation when ByteRange is specified.
This commit makes QPDF always uses hexadecimal strings representation
instead of literal strings for it.
Diffstat (limited to 'libqpdf/QPDFWriter.cc')
-rw-r--r-- | libqpdf/QPDFWriter.cc | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/libqpdf/QPDFWriter.cc b/libqpdf/QPDFWriter.cc index 116d493f..4397c3ad 100644 --- a/libqpdf/QPDFWriter.cc +++ b/libqpdf/QPDFWriter.cc @@ -1687,7 +1687,20 @@ QPDFWriter::unparseObject(QPDFObjectHandle object, int level, writeStringNoQDF(" "); writeString(QPDF_Name::normalizeName(key)); writeString(" "); - unparseChild(object.getKey(key), level + 1, child_flags); + if (key == "/Contents" && + object.hasKey("/Type") && + object.getKey("/Type").isName() && + object.getKey("/Type").getName() == "/Sig" && + object.hasKey("/ByteRange")) + { + QTC::TC("qpdf", "QPDFWriter no encryption sig contents"); + unparseChild(object.getKey(key), level + 1, + child_flags | f_hex_string); + } + else + { + unparseChild(object.getKey(key), level + 1, child_flags); + } writeStringQDF("\n"); } @@ -1882,6 +1895,10 @@ QPDFWriter::unparseObject(QPDFObjectHandle object, int level, val = QPDF_String(std::string(tmp, vlen)).unparse(); } } + else if (flags & f_hex_string) + { + val = QPDF_String(object.getStringValue()).unparse(true); + } else { val = object.unparseResolved(); |