aboutsummaryrefslogtreecommitdiffstats
path: root/libqpdf/QPDF_encryption.cc
diff options
context:
space:
mode:
authorJay Berkenbilt <ejb@ql.org>2009-10-05 02:42:48 +0200
committerJay Berkenbilt <ejb@ql.org>2009-10-05 02:42:48 +0200
commitc2023db265ea35ad7d0ab0cd989f16479bcb798d (patch)
treea4cbc126f6152a185ec10b58f5330c7bfbe5f90a /libqpdf/QPDF_encryption.cc
parentc1e53f148096c329650068694fbde82f018560bf (diff)
downloadqpdf-c2023db265ea35ad7d0ab0cd989f16479bcb798d.tar.zst
Implement changes suggested by Zarko and our subsequent conversations:
- Add a way to set the minimum PDF version - Add a way to force the PDF version - Have isEncrypted return true if an /Encrypt dictionary exists even when we can't read the file - Allow qpdf_init_write to be called multiple times - Update some comments in headers git-svn-id: svn+q:///qpdf/trunk@748 71b93d88-0707-0410-a8cf-f5a4172ac649
Diffstat (limited to 'libqpdf/QPDF_encryption.cc')
-rw-r--r--libqpdf/QPDF_encryption.cc6
1 files changed, 5 insertions, 1 deletions
diff --git a/libqpdf/QPDF_encryption.cc b/libqpdf/QPDF_encryption.cc
index 5d061dfd..075ab22a 100644
--- a/libqpdf/QPDF_encryption.cc
+++ b/libqpdf/QPDF_encryption.cc
@@ -289,6 +289,11 @@ QPDF::initializeEncryption()
return;
}
+ // Go ahead and set this->encryption here. That way, isEncrypted
+ // will return true even if there were errors reading the
+ // encryption dictionary.
+ this->encrypted = true;
+
QPDFObjectHandle id_obj = this->trailer.getKey("/ID");
if (! (id_obj.isArray() &&
(id_obj.getArrayNItems() == 2) &&
@@ -377,7 +382,6 @@ QPDF::initializeEncryption()
throw QPDFExc(this->file.getName() + ": invalid password");
}
- this->encrypted = true;
this->encryption_key = compute_encryption_key(this->user_password, data);
}