diff --git a/Userland/Libraries/LibPDF/Encryption.cpp b/Userland/Libraries/LibPDF/Encryption.cpp index 6758b005de..3a3b9a8707 100644 --- a/Userland/Libraries/LibPDF/Encryption.cpp +++ b/Userland/Libraries/LibPDF/Encryption.cpp @@ -95,8 +95,7 @@ StandardSecurityHandler::StandardSecurityHandler(Document* document, size_t revi { } -template<> -ByteBuffer StandardSecurityHandler::compute_user_password_value(ByteBuffer password_string) +ByteBuffer StandardSecurityHandler::compute_user_password_value_v2(ByteBuffer password_string) { // Algorithm 4: Computing the encryption dictionary's U (user password) // value (Security handlers of revision 2) @@ -116,8 +115,7 @@ ByteBuffer StandardSecurityHandler::compute_user_password_value(ByteBuffer return output; } -template<> -ByteBuffer StandardSecurityHandler::compute_user_password_value(ByteBuffer password_string) +ByteBuffer StandardSecurityHandler::compute_user_password_value_v3_and_newer(ByteBuffer password_string) { // Algorithm 5: Computing the encryption dictionary's U (user password) // value (Security handlers of revision 3 or greater) @@ -177,9 +175,9 @@ bool StandardSecurityHandler::try_provide_user_password(StringView password_stri // supplied password string. ByteBuffer password_buffer = MUST(ByteBuffer::copy(password_string.bytes())); if (m_revision == 2) { - password_buffer = compute_user_password_value(password_buffer); + password_buffer = compute_user_password_value_v2(password_buffer); } else { - password_buffer = compute_user_password_value(password_buffer); + password_buffer = compute_user_password_value_v3_and_newer(password_buffer); } // b) If the result of step (a) is equal to the value of the encryption diff --git a/Userland/Libraries/LibPDF/Encryption.h b/Userland/Libraries/LibPDF/Encryption.h index d740202afa..00ba202243 100644 --- a/Userland/Libraries/LibPDF/Encryption.h +++ b/Userland/Libraries/LibPDF/Encryption.h @@ -41,8 +41,8 @@ protected: void decrypt(NonnullRefPtr, Reference reference) const override; private: - template - ByteBuffer compute_user_password_value(ByteBuffer password_string); + ByteBuffer compute_user_password_value_v2(ByteBuffer password_string); + ByteBuffer compute_user_password_value_v3_and_newer(ByteBuffer password_string); ByteBuffer compute_encryption_key(ByteBuffer password_string);