mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 10:38:11 +00:00
LibPDF: Add implementation of the Standard security handler
Security handlers manage encryption and decription of PDF files. The standard security handler uses RC4/MD5 to perform its crypto (AES as well, but that is not yet implemented).
This commit is contained in:
parent
c98bda8ce6
commit
5b316462b2
9 changed files with 522 additions and 3 deletions
|
@ -160,6 +160,18 @@ void PDFViewerWidget::open_file(Core::File& file)
|
|||
|
||||
auto document = maybe_document.release_value();
|
||||
|
||||
if (auto sh = document->security_handler(); !sh->has_user_password()) {
|
||||
// FIXME: Prompt the user for a password
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
auto result = document->initialize();
|
||||
if (result.is_error()) {
|
||||
auto error = result.release_error();
|
||||
GUI::MessageBox::show_error(nullptr, String::formatted("Couldn't load PDF {}:\n{}", file.filename(), error.message()));
|
||||
return;
|
||||
}
|
||||
|
||||
m_viewer->set_document(document);
|
||||
m_total_page_label->set_text(String::formatted("of {}", document->get_page_count()));
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue