mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-02 14:19:48 +00:00
LibPDF: Make try_provide_user_password() work for R6+ files
try_provide_user_password() calls compute_encryption_key_r6_and_later() now. This checks both owner and user passwords. (For pre-R6 files, owner password checking isn't yet implemented, as far as I can tell.) With this, CIPA_DC-007-2021_E.pdf (or other AESV3-encrypted files) successfully compute a file encryption key (...and then hit the TODO() in StandardSecurityHandler::crypt() for AESV3, but it's still good progress.)
This commit is contained in:
parent
0428308420
commit
9cbdb334ab
Notes:
sideshowbarker
2024-07-16 20:12:13 +09:00
Author: https://github.com/nico
Commit: 9cbdb334ab
Pull-request: https://github.com/SerenityOS/serenity/pull/20108
Reviewed-by: https://github.com/mattco98 ✅
1 changed files with 6 additions and 3 deletions
|
@ -342,10 +342,13 @@ bool StandardSecurityHandler::authenticate_owner_password_r6_and_later(StringVie
|
|||
bool StandardSecurityHandler::try_provide_user_password(StringView password_string)
|
||||
{
|
||||
bool has_user_password;
|
||||
if (m_revision >= 6)
|
||||
has_user_password = authenticate_user_password_r6_and_later(password_string);
|
||||
else
|
||||
if (m_revision >= 6) {
|
||||
// This checks both owner and user password.
|
||||
auto password = ByteBuffer::copy(password_string.bytes()).release_value_but_fixme_should_propagate_errors();
|
||||
has_user_password = compute_encryption_key_r6_and_later(move(password));
|
||||
} else {
|
||||
has_user_password = authenticate_user_password_r2_to_r5(password_string);
|
||||
}
|
||||
|
||||
if (!has_user_password)
|
||||
m_encryption_key = {};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue