2
1
mirror of https://github.com/qpdf/qpdf.git synced 2024-06-06 04:10:52 +00:00

More testing for Unicode passwords

This commit is contained in:
Jay Berkenbilt 2019-01-19 14:11:53 -05:00
parent edc3b309bc
commit 0a3057dc0a
3 changed files with 49 additions and 1 deletions

View File

@ -3378,7 +3378,8 @@ foreach my $d (@unicode_pw_cases)
}
}
$n_tests += 2;
$n_tests += 5;
$td->runtest("bytes fallback warning",
{$td->COMMAND =>
"qpdf --encrypt \@password-bare-complex-utf8 o 128 --" .
@ -3402,6 +3403,23 @@ $td->runtest("bytes fallback warning",
$td->NORMALIZE_NEWLINES);
}
# Exercise passing Unicode passwords via the command line. This tests
# wmain for Windows and assumes a UTF-8 locale for other platforms.
$td->runtest("Unicode at CLI",
{$td->COMMAND =>
"qpdf --encrypt π ʬ 256 --" .
" minimal.pdf a.pdf"},
{$td->STRING => "", $td->EXIT_STATUS => 0},
$td->NORMALIZE_NEWLINES);
$td->runtest("Decrypt using user password",
{$td->COMMAND => "qpdf --show-encryption a.pdf --password=π"},
{$td->FILE => "unicode-up.out", $td->EXIT_STATUS => 0},
$td->NORMALIZE_NEWLINES);
$td->runtest("Decrypt using owner password",
{$td->COMMAND => "qpdf --show-encryption a.pdf --password=ʬ"},
{$td->FILE => "unicode-op.out", $td->EXIT_STATUS => 0},
$td->NORMALIZE_NEWLINES);
show_ntests();
# ----------
$td->notify("--- Check from C API ---");

View File

@ -0,0 +1,15 @@
R = 6
P = -4
User password =
extract for accessibility: allowed
extract for any purpose: allowed
print low resolution: allowed
print high resolution: allowed
modify document assembly: allowed
modify forms: allowed
modify annotations: allowed
modify other: allowed
modify anything: allowed
stream encryption method: AESv3
string encryption method: AESv3
file encryption method: AESv3

View File

@ -0,0 +1,15 @@
R = 6
P = -4
User password = π
extract for accessibility: allowed
extract for any purpose: allowed
print low resolution: allowed
print high resolution: allowed
modify document assembly: allowed
modify forms: allowed
modify annotations: allowed
modify other: allowed
modify anything: allowed
stream encryption method: AESv3
string encryption method: AESv3
file encryption method: AESv3