diff --git a/Tests/LibPDF/CMakeLists.txt b/Tests/LibPDF/CMakeLists.txt index 514cea6353..536be7f6fd 100644 --- a/Tests/LibPDF/CMakeLists.txt +++ b/Tests/LibPDF/CMakeLists.txt @@ -10,6 +10,7 @@ set(TEST_FILES complex.pdf linearized.pdf non-linearized.pdf + password-is-sup.pdf type1.pdf ) install(FILES ${TEST_FILES} DESTINATION home/anon/Documents/pdf) diff --git a/Tests/LibPDF/TestPDF.cpp b/Tests/LibPDF/TestPDF.cpp index fe6ef90772..1acb48fdd6 100644 --- a/Tests/LibPDF/TestPDF.cpp +++ b/Tests/LibPDF/TestPDF.cpp @@ -48,3 +48,12 @@ TEST_CASE(truncated_pdf_header_issue_10717) auto document = PDF::Document::create(string.bytes()); EXPECT(document.is_error()); } + +TEST_CASE(encrypted_with_aes) +{ + auto file = MUST(Core::MappedFile::map("password-is-sup.pdf"sv)); + auto document = MUST(PDF::Document::create(file->bytes())); + EXPECT(document->security_handler()->try_provide_user_password("sup"sv)); + MUST(document->initialize()); + EXPECT_EQ(document->get_page_count(), 1U); +} diff --git a/Tests/LibPDF/password-is-sup.pdf b/Tests/LibPDF/password-is-sup.pdf new file mode 100644 index 0000000000..e725cdc2a5 Binary files /dev/null and b/Tests/LibPDF/password-is-sup.pdf differ