From c2023db265ea35ad7d0ab0cd989f16479bcb798d Mon Sep 17 00:00:00 2001 From: Jay Berkenbilt Date: Mon, 5 Oct 2009 00:42:48 +0000 Subject: 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 --- libqpdf/QPDF_encryption.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'libqpdf/QPDF_encryption.cc') 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); } -- cgit v1.2.3-54-g00ecf