Kaydet (Commit) d841f348 authored tarafından Eike Rathke's avatar Eike Rathke

Add ScOoxPasswordHash::verifyPassword(), tdf#104250 prep

Change-Id: Ife588fa0626b01336813e956a25e51541d1096e6
üst 5f4df7af
......@@ -55,6 +55,7 @@ struct ScOoxPasswordHash
maHashValue.clear();
maSaltValue.clear();
}
bool verifyPassword( const OUString& aPassText ) const;
};
namespace ScPassHashHelper
......
......@@ -20,6 +20,7 @@
#include <tabprotection.hxx>
#include <svl/PasswordHelper.hxx>
#include <comphelper/docpasswordhelper.hxx>
#include <comphelper/hash.hxx>
#include <osl/diagnose.h>
#include <document.hxx>
......@@ -88,6 +89,19 @@ ScPasswordHash ScPassHashHelper::getHashTypeFromURI(const OUString& rURI)
return PASSHASH_UNSPECIFIED;
}
bool ScOoxPasswordHash::verifyPassword( const OUString& aPassText ) const
{
if (!hasPassword())
return false;
const OUString aHash( comphelper::Hash::calculateHashBase64( aPassText, maSaltValue, mnSpinCount, maAlgorithmName));
if (aHash.isEmpty())
// unsupported algorithm
return false;
return aHash == maHashValue;
}
ScPassHashProtectable::~ScPassHashProtectable()
{
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment