mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 02:27:43 +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
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 StandardSecurityHandler::try_provide_user_password(StringView password_string)
|
||||||
{
|
{
|
||||||
bool has_user_password;
|
bool has_user_password;
|
||||||
if (m_revision >= 6)
|
if (m_revision >= 6) {
|
||||||
has_user_password = authenticate_user_password_r6_and_later(password_string);
|
// This checks both owner and user password.
|
||||||
else
|
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);
|
has_user_password = authenticate_user_password_r2_to_r5(password_string);
|
||||||
|
}
|
||||||
|
|
||||||
if (!has_user_password)
|
if (!has_user_password)
|
||||||
m_encryption_key = {};
|
m_encryption_key = {};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue