aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--README.maintainer2
-rw-r--r--configure.ac2
-rw-r--r--libqpdf/qpdf-c.cc8
-rw-r--r--manual/qpdf-manual.xml4
-rw-r--r--qpdf.spec2
-rw-r--r--qpdf/qpdf-ctest.c43
-rw-r--r--qpdf/qpdf.cc2
-rw-r--r--qpdf/qtest/qpdf.test25
-rw-r--r--qpdf/qtest/qpdf/c-decrypt-with-owner.pdfbin0 -> 9668 bytes
-rw-r--r--qpdf/qtest/qpdf/c-decrypt-with-user.pdfbin0 -> 9668 bytes
-rw-r--r--qpdf/qtest/qpdf/c-r2.pdfbin0 -> 9893 bytes
-rw-r--r--qpdf/qtest/qpdf/c-r3.pdfbin0 -> 9897 bytes
12 files changed, 79 insertions, 9 deletions
diff --git a/README.maintainer b/README.maintainer
index 2fe189f0..28fb6119 100644
--- a/README.maintainer
+++ b/README.maintainer
@@ -16,6 +16,8 @@ Release Reminders
make_dist verifies this consistency.
+ * Update release date in manual/qpdf-manual.xml
+
* Each year, update copyright notices. Just search for Copyright.
Last updated: 2009.
diff --git a/configure.ac b/configure.ac
index e66af81f..21fd01c6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2,7 +2,7 @@ dnl Process this file with autoconf to produce a configure script.
dnl This config.in requires autoconf 2.5 or greater.
AC_PREREQ(2.60)
-AC_INIT(qpdf,2.0.6)
+AC_INIT(qpdf,2.1.a1)
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_FILES([autoconf.mk])
diff --git a/libqpdf/qpdf-c.cc b/libqpdf/qpdf-c.cc
index 5f894895..9e2d0cbf 100644
--- a/libqpdf/qpdf-c.cc
+++ b/libqpdf/qpdf-c.cc
@@ -376,10 +376,10 @@ void qpdf_set_r3_encryption_parameters(
((print == QPDF_R3_PRINT_LOW) ? QPDFWriter::r3p_low :
(print == QPDF_R3_PRINT_NONE) ? QPDFWriter::r3p_none :
QPDFWriter::r3p_full),
- ((print == QPDF_R3_MODIFY_ANNOTATE) ? QPDFWriter::r3m_annotate :
- (print == QPDF_R3_MODIFY_FORM) ? QPDFWriter::r3m_form :
- (print == QPDF_R3_MODIFY_ASSEMBLY) ? QPDFWriter::r3m_assembly :
- (print == QPDF_R3_MODIFY_NONE) ? QPDFWriter::r3m_none :
+ ((modify == QPDF_R3_MODIFY_ANNOTATE) ? QPDFWriter::r3m_annotate :
+ (modify == QPDF_R3_MODIFY_FORM) ? QPDFWriter::r3m_form :
+ (modify == QPDF_R3_MODIFY_ASSEMBLY) ? QPDFWriter::r3m_assembly :
+ (modify == QPDF_R3_MODIFY_NONE) ? QPDFWriter::r3m_none :
QPDFWriter::r3m_all));
}
diff --git a/manual/qpdf-manual.xml b/manual/qpdf-manual.xml
index eb3c54b9..d5f43cac 100644
--- a/manual/qpdf-manual.xml
+++ b/manual/qpdf-manual.xml
@@ -5,8 +5,8 @@
<!ENTITY mdash "&#x2014;">
<!ENTITY ndash "&#x2013;">
<!ENTITY nbsp "&#xA0;">
-<!ENTITY swversion "2.0.6">
-<!ENTITY lastreleased "May 3, 2009">
+<!ENTITY swversion "2.1.a1">
+<!ENTITY lastreleased "XXX, 2009">
]>
<book>
<bookinfo>
diff --git a/qpdf.spec b/qpdf.spec
index f7fd855a..433d3bd1 100644
--- a/qpdf.spec
+++ b/qpdf.spec
@@ -1,6 +1,6 @@
Summary: Command-line tools and library for transforming PDF files
Name: qpdf
-Version: 2.0.6
+Version: 2.1.a1
Release: 1%{?dist}
License: Artistic
Group: System Environment/Libraries
diff --git a/qpdf/qpdf-ctest.c b/qpdf/qpdf-ctest.c
index 456f06c6..42d8f9f4 100644
--- a/qpdf/qpdf-ctest.c
+++ b/qpdf/qpdf-ctest.c
@@ -159,6 +159,46 @@ static void test10(char const* infile,
report_errors();
}
+static void test11(char const* infile,
+ char const* password,
+ char const* outfile)
+{
+ qpdf_read(qpdf, infile, password);
+ qpdf_init_write(qpdf, outfile);
+ qpdf_set_static_ID(qpdf, QPDF_TRUE);
+ qpdf_set_r2_encryption_parameters(
+ qpdf, "user1", "owner1", QPDF_FALSE, QPDF_TRUE, QPDF_TRUE, QPDF_TRUE);
+ qpdf_write(qpdf);
+ report_errors();
+}
+
+static void test12(char const* infile,
+ char const* password,
+ char const* outfile)
+{
+ qpdf_read(qpdf, infile, password);
+ qpdf_init_write(qpdf, outfile);
+ qpdf_set_static_ID(qpdf, QPDF_TRUE);
+ qpdf_set_r3_encryption_parameters(
+ qpdf, "user2", "owner2", QPDF_TRUE, QPDF_TRUE,
+ QPDF_R3_PRINT_LOW, QPDF_R3_MODIFY_ALL);
+ qpdf_write(qpdf);
+ report_errors();
+}
+
+static void test13(char const* infile,
+ char const* password,
+ char const* outfile)
+{
+ qpdf_read(qpdf, infile, password);
+ printf("user password: %s\n", qpdf_get_user_password(qpdf));
+ qpdf_init_write(qpdf, outfile);
+ qpdf_set_static_ID(qpdf, QPDF_TRUE);
+ qpdf_set_preserve_encryption(qpdf, QPDF_FALSE);
+ qpdf_write(qpdf);
+ report_errors();
+}
+
int main(int argc, char* argv[])
{
char* whoami = 0;
@@ -202,6 +242,9 @@ int main(int argc, char* argv[])
(n == 8) ? test08 :
(n == 9) ? test09 :
(n == 10) ? test10 :
+ (n == 11) ? test11 :
+ (n == 12) ? test12 :
+ (n == 13) ? test13 :
0);
if (fn == 0)
diff --git a/qpdf/qpdf.cc b/qpdf/qpdf.cc
index 9cd0df7b..cc65328f 100644
--- a/qpdf/qpdf.cc
+++ b/qpdf/qpdf.cc
@@ -472,7 +472,7 @@ int main(int argc, char* argv[])
// 1 2 3 4 5 6 7 8
// 12345678901234567890123456789012345678901234567890123456789012345678901234567890
std::cout
- << whoami << " version 2.0.6" << std::endl
+ << whoami << " version 2.1.a1" << std::endl
<< "Copyright (c) 2005-2009 Jay Berkenbilt"
<< std::endl
<< "This software may be distributed under the terms of version 2 of the"
diff --git a/qpdf/qtest/qpdf.test b/qpdf/qtest/qpdf.test
index 70021676..8cf355b0 100644
--- a/qpdf/qtest/qpdf.test
+++ b/qpdf/qtest/qpdf.test
@@ -851,6 +851,31 @@ $td->runtest("invalid password",
$td->EXIT_STATUS => 2},
$td->NORMALIZE_NEWLINES);
+my @cenc = (
+ [11, 'hybrid-xref.pdf', "''", 'r2', ""],
+ [12, 'hybrid-xref.pdf', "''", 'r3', ""],
+ [13, 'c-r2.pdf', 'user1', 'decrypt with user',
+ "user password: user1\n"],
+ [13, 'c-r3.pdf', 'owner2', 'decrypt with owner',
+ "user password: user2\n"],
+ );
+$n_tests += 2 * @cenc;
+
+foreach my $d (@cenc)
+{
+ my ($n, $infile, $pass, $description, $output) = @$d;
+ my $outfile = $description;
+ $outfile =~ s/ /-/g;
+ my $outfile = "c-$outfile.pdf";
+ $td->runtest("C API encryption: $description",
+ {$td->COMMAND => "qpdf-ctest $n $infile $pass a.pdf"},
+ {$td->STRING => $output, $td->EXIT_STATUS => 0},
+ $td->NORMALIZE_NEWLINES);
+ $td->runtest("check $description",
+ {$td->FILE => "a.pdf"},
+ {$td->FILE => $outfile});
+}
+
# Test combinations of linearization and encryption. Note that we do
# content checks on encrypted and linearized files in various
# combinations below. Here we are just making sure that they are
diff --git a/qpdf/qtest/qpdf/c-decrypt-with-owner.pdf b/qpdf/qtest/qpdf/c-decrypt-with-owner.pdf
new file mode 100644
index 00000000..9a0f23b4
--- /dev/null
+++ b/qpdf/qtest/qpdf/c-decrypt-with-owner.pdf
Binary files differ
diff --git a/qpdf/qtest/qpdf/c-decrypt-with-user.pdf b/qpdf/qtest/qpdf/c-decrypt-with-user.pdf
new file mode 100644
index 00000000..9a0f23b4
--- /dev/null
+++ b/qpdf/qtest/qpdf/c-decrypt-with-user.pdf
Binary files differ
diff --git a/qpdf/qtest/qpdf/c-r2.pdf b/qpdf/qtest/qpdf/c-r2.pdf
new file mode 100644
index 00000000..0301696c
--- /dev/null
+++ b/qpdf/qtest/qpdf/c-r2.pdf
Binary files differ
diff --git a/qpdf/qtest/qpdf/c-r3.pdf b/qpdf/qtest/qpdf/c-r3.pdf
new file mode 100644
index 00000000..55493b2e
--- /dev/null
+++ b/qpdf/qtest/qpdf/c-r3.pdf
Binary files differ