diff options
author | Jay Berkenbilt <ejb@ql.org> | 2010-04-25 16:55:36 +0200 |
---|---|---|
committer | Jay Berkenbilt <ejb@ql.org> | 2010-04-25 16:55:36 +0200 |
commit | fc8f93053d4d11c07fe942a9baa9e23b98d80369 (patch) | |
tree | 477aaf35a5dd241142c342b18ff23e678709c501 /libqpdf | |
parent | 349c80c895c961afe4654e0590698f879becca22 (diff) | |
download | qpdf-fc8f93053d4d11c07fe942a9baa9e23b98d80369.tar.zst |
don't place restrictions on length of /ID strings
git-svn-id: svn+q:///qpdf/trunk@961 71b93d88-0707-0410-a8cf-f5a4172ac649
Diffstat (limited to 'libqpdf')
-rw-r--r-- | libqpdf/QPDF_encryption.cc | 11 |
1 files changed, 1 insertions, 10 deletions
diff --git a/libqpdf/QPDF_encryption.cc b/libqpdf/QPDF_encryption.cc index d6b0ae23..8ac0ec90 100644 --- a/libqpdf/QPDF_encryption.cc +++ b/libqpdf/QPDF_encryption.cc @@ -24,7 +24,6 @@ static char const padding_string[] = { }; static unsigned int const O_key_bytes = sizeof(MD5::Digest); -static unsigned int const id_bytes = 16; static unsigned int const key_bytes = 32; void @@ -145,7 +144,7 @@ QPDF::compute_encryption_key( pbytes[2] = (char) ((data.P >> 16) & 0xff); pbytes[3] = (char) ((data.P >> 24) & 0xff); md5.encodeDataIncrementally(pbytes, 4); - md5.encodeDataIncrementally(data.id1.c_str(), id_bytes); + md5.encodeDataIncrementally(data.id1.c_str(), data.id1.length()); if ((data.R >= 4) && (! data.encrypt_metadata)) { char bytes[4]; @@ -343,14 +342,6 @@ QPDF::initializeEncryption() } std::string id1 = id_obj.getArrayItem(0).getStringValue(); - if (id1.length() != id_bytes) - { - throw QPDFExc(qpdf_e_damaged_pdf, this->file.getName(), - "trailer", this->file.getLastOffset(), - "first /ID string in trailer dictionary has " - "incorrect length"); - } - QPDFObjectHandle encryption_dict = this->trailer.getKey("/Encrypt"); if (! encryption_dict.isDictionary()) { |