diff options
-rw-r--r-- | include/m_crypto.h | 1 | ||||
-rw-r--r-- | src/core/stdcrypt/encrypt.cpp | 6 | ||||
-rw-r--r-- | src/core/stdcrypt/stdcrypt.h | 1 |
3 files changed, 8 insertions, 0 deletions
diff --git a/include/m_crypto.h b/include/m_crypto.h index 0d79e2f9ba..32b532f9b1 100644 --- a/include/m_crypto.h +++ b/include/m_crypto.h @@ -41,6 +41,7 @@ struct MICryptoEngine STDMETHOD_(void, purgeKey)(void)PURE; // purges a key from memory
// sets the master password (in utf-8)
+ STDMETHOD_(bool, checkPassword)(const char *pszPassword) PURE;
STDMETHOD_(void, setPassword)(const char *pszPassword) PURE;
// result must be freed using mir_free or assigned to mir_ptr<BYTE>
diff --git a/src/core/stdcrypt/encrypt.cpp b/src/core/stdcrypt/encrypt.cpp index 5be76f1c54..1616ac376f 100644 --- a/src/core/stdcrypt/encrypt.cpp +++ b/src/core/stdcrypt/encrypt.cpp @@ -104,6 +104,12 @@ void CStdCrypt::purgeKey(void) m_valid = false;
}
+// checks the master password (in utf-8)
+bool CStdCrypt::checkPassword(const char *pszPassword)
+{
+ return m_password == pszPassword;
+}
+
// sets the master password (in utf-8)
void CStdCrypt::setPassword(const char *pszPassword)
{
diff --git a/src/core/stdcrypt/stdcrypt.h b/src/core/stdcrypt/stdcrypt.h index 6129cabcc8..7b3df473d5 100644 --- a/src/core/stdcrypt/stdcrypt.h +++ b/src/core/stdcrypt/stdcrypt.h @@ -45,6 +45,7 @@ struct CStdCrypt : public MICryptoEngine, public MZeroedObject STDMETHODIMP_(void) purgeKey(void); // purges a key from memory
// sets the master password (in utf-8)
+ STDMETHODIMP_(bool) checkPassword(const char *pszPassword);
STDMETHODIMP_(void) setPassword(const char *pszPassword);
// result must be freed using mir_free or assigned to mir_ptr<BYTE>
|