mirror of
https://github.com/qpdf/qpdf.git
synced 2024-09-22 01:59:10 +00:00
42 lines
1.2 KiB
Perl
42 lines
1.2 KiB
Perl
#!/usr/bin/env perl
|
|
require 5.008;
|
|
use warnings;
|
|
use strict;
|
|
|
|
unshift(@INC, '.');
|
|
require qpdf_test_helpers;
|
|
|
|
chdir("qpdf") or die "chdir testdir failed: $!\n";
|
|
|
|
require TestDriver;
|
|
|
|
cleanup();
|
|
|
|
my $td = new TestDriver('positive-p');
|
|
|
|
my $n_tests = 4;
|
|
|
|
# Files have been seen where /P in the encryption dictionary was an
|
|
# unsigned rather than a signed integer. To create
|
|
# encrypted-positive-P.pdf, I temporarily modified QPDFWriter.cc to
|
|
# introduce this error.
|
|
|
|
$td->runtest("decrypt positive P",
|
|
{$td->COMMAND =>
|
|
"qpdf --decrypt --static-id encrypted-positive-P.pdf a.pdf"},
|
|
{$td->STRING => "", $td->EXIT_STATUS => 0});
|
|
$td->runtest("check output",
|
|
{$td->FILE => "a.pdf"},
|
|
{$td->FILE => "decrypted-positive-P.pdf"});
|
|
$td->runtest("copy encryption positive P",
|
|
{$td->COMMAND =>
|
|
"qpdf --static-id --static-aes-iv" .
|
|
" encrypted-positive-P.pdf a.pdf"},
|
|
{$td->STRING => "", $td->EXIT_STATUS => 0});
|
|
$td->runtest("check output",
|
|
{$td->FILE => "a.pdf"},
|
|
{$td->FILE => "copied-positive-P.pdf"});
|
|
|
|
cleanup();
|
|
$td->report($n_tests);
|