mirror of
https://github.com/qpdf/qpdf.git
synced 2025-01-03 07:12:28 +00:00
finished testing C API
git-svn-id: svn+q:///qpdf/trunk@734 71b93d88-0707-0410-a8cf-f5a4172ac649
This commit is contained in:
parent
8d7bb3ff50
commit
6bdac26369
@ -16,6 +16,8 @@ Release Reminders
|
|||||||
|
|
||||||
make_dist verifies this consistency.
|
make_dist verifies this consistency.
|
||||||
|
|
||||||
|
* Update release date in manual/qpdf-manual.xml
|
||||||
|
|
||||||
* Each year, update copyright notices. Just search for Copyright.
|
* Each year, update copyright notices. Just search for Copyright.
|
||||||
Last updated: 2009.
|
Last updated: 2009.
|
||||||
|
|
||||||
|
@ -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.
|
dnl This config.in requires autoconf 2.5 or greater.
|
||||||
|
|
||||||
AC_PREREQ(2.60)
|
AC_PREREQ(2.60)
|
||||||
AC_INIT(qpdf,2.0.6)
|
AC_INIT(qpdf,2.1.a1)
|
||||||
|
|
||||||
AC_CONFIG_MACRO_DIR([m4])
|
AC_CONFIG_MACRO_DIR([m4])
|
||||||
AC_CONFIG_FILES([autoconf.mk])
|
AC_CONFIG_FILES([autoconf.mk])
|
||||||
|
@ -376,10 +376,10 @@ void qpdf_set_r3_encryption_parameters(
|
|||||||
((print == QPDF_R3_PRINT_LOW) ? QPDFWriter::r3p_low :
|
((print == QPDF_R3_PRINT_LOW) ? QPDFWriter::r3p_low :
|
||||||
(print == QPDF_R3_PRINT_NONE) ? QPDFWriter::r3p_none :
|
(print == QPDF_R3_PRINT_NONE) ? QPDFWriter::r3p_none :
|
||||||
QPDFWriter::r3p_full),
|
QPDFWriter::r3p_full),
|
||||||
((print == QPDF_R3_MODIFY_ANNOTATE) ? QPDFWriter::r3m_annotate :
|
((modify == QPDF_R3_MODIFY_ANNOTATE) ? QPDFWriter::r3m_annotate :
|
||||||
(print == QPDF_R3_MODIFY_FORM) ? QPDFWriter::r3m_form :
|
(modify == QPDF_R3_MODIFY_FORM) ? QPDFWriter::r3m_form :
|
||||||
(print == QPDF_R3_MODIFY_ASSEMBLY) ? QPDFWriter::r3m_assembly :
|
(modify == QPDF_R3_MODIFY_ASSEMBLY) ? QPDFWriter::r3m_assembly :
|
||||||
(print == QPDF_R3_MODIFY_NONE) ? QPDFWriter::r3m_none :
|
(modify == QPDF_R3_MODIFY_NONE) ? QPDFWriter::r3m_none :
|
||||||
QPDFWriter::r3m_all));
|
QPDFWriter::r3m_all));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,8 +5,8 @@
|
|||||||
<!ENTITY mdash "—">
|
<!ENTITY mdash "—">
|
||||||
<!ENTITY ndash "–">
|
<!ENTITY ndash "–">
|
||||||
<!ENTITY nbsp " ">
|
<!ENTITY nbsp " ">
|
||||||
<!ENTITY swversion "2.0.6">
|
<!ENTITY swversion "2.1.a1">
|
||||||
<!ENTITY lastreleased "May 3, 2009">
|
<!ENTITY lastreleased "XXX, 2009">
|
||||||
]>
|
]>
|
||||||
<book>
|
<book>
|
||||||
<bookinfo>
|
<bookinfo>
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
Summary: Command-line tools and library for transforming PDF files
|
Summary: Command-line tools and library for transforming PDF files
|
||||||
Name: qpdf
|
Name: qpdf
|
||||||
Version: 2.0.6
|
Version: 2.1.a1
|
||||||
Release: 1%{?dist}
|
Release: 1%{?dist}
|
||||||
License: Artistic
|
License: Artistic
|
||||||
Group: System Environment/Libraries
|
Group: System Environment/Libraries
|
||||||
|
@ -159,6 +159,46 @@ static void test10(char const* infile,
|
|||||||
report_errors();
|
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[])
|
int main(int argc, char* argv[])
|
||||||
{
|
{
|
||||||
char* whoami = 0;
|
char* whoami = 0;
|
||||||
@ -202,6 +242,9 @@ int main(int argc, char* argv[])
|
|||||||
(n == 8) ? test08 :
|
(n == 8) ? test08 :
|
||||||
(n == 9) ? test09 :
|
(n == 9) ? test09 :
|
||||||
(n == 10) ? test10 :
|
(n == 10) ? test10 :
|
||||||
|
(n == 11) ? test11 :
|
||||||
|
(n == 12) ? test12 :
|
||||||
|
(n == 13) ? test13 :
|
||||||
0);
|
0);
|
||||||
|
|
||||||
if (fn == 0)
|
if (fn == 0)
|
||||||
|
@ -472,7 +472,7 @@ int main(int argc, char* argv[])
|
|||||||
// 1 2 3 4 5 6 7 8
|
// 1 2 3 4 5 6 7 8
|
||||||
// 12345678901234567890123456789012345678901234567890123456789012345678901234567890
|
// 12345678901234567890123456789012345678901234567890123456789012345678901234567890
|
||||||
std::cout
|
std::cout
|
||||||
<< whoami << " version 2.0.6" << std::endl
|
<< whoami << " version 2.1.a1" << std::endl
|
||||||
<< "Copyright (c) 2005-2009 Jay Berkenbilt"
|
<< "Copyright (c) 2005-2009 Jay Berkenbilt"
|
||||||
<< std::endl
|
<< std::endl
|
||||||
<< "This software may be distributed under the terms of version 2 of the"
|
<< "This software may be distributed under the terms of version 2 of the"
|
||||||
|
@ -851,6 +851,31 @@ $td->runtest("invalid password",
|
|||||||
$td->EXIT_STATUS => 2},
|
$td->EXIT_STATUS => 2},
|
||||||
$td->NORMALIZE_NEWLINES);
|
$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
|
# Test combinations of linearization and encryption. Note that we do
|
||||||
# content checks on encrypted and linearized files in various
|
# content checks on encrypted and linearized files in various
|
||||||
# combinations below. Here we are just making sure that they are
|
# combinations below. Here we are just making sure that they are
|
||||||
|
BIN
qpdf/qtest/qpdf/c-decrypt-with-owner.pdf
Normal file
BIN
qpdf/qtest/qpdf/c-decrypt-with-owner.pdf
Normal file
Binary file not shown.
BIN
qpdf/qtest/qpdf/c-decrypt-with-user.pdf
Normal file
BIN
qpdf/qtest/qpdf/c-decrypt-with-user.pdf
Normal file
Binary file not shown.
BIN
qpdf/qtest/qpdf/c-r2.pdf
Normal file
BIN
qpdf/qtest/qpdf/c-r2.pdf
Normal file
Binary file not shown.
BIN
qpdf/qtest/qpdf/c-r3.pdf
Normal file
BIN
qpdf/qtest/qpdf/c-r3.pdf
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user