Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/keepassxreboot/keepassxc.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJanek Bevendorff <janek@jbev.net>2018-03-01 23:25:29 +0300
committerJonathan White <droidmonkey@users.noreply.github.com>2018-03-02 03:26:18 +0300
commit199f0932bfdeeb078f928991c0aa646bd4e3f410 (patch)
treeabdb566a90c2f8ce8a65972afb0f507a0ccab0a5 /tests/mock
parente6c19fdcb1d35e167839435a42b0eeb52488f453 (diff)
Add additional KDBX4 upgrade tests for composite key integrity
Diffstat (limited to 'tests/mock')
-rw-r--r--tests/mock/MockChallengeResponseKey.cpp9
-rw-r--r--tests/mock/MockChallengeResponseKey.h8
2 files changed, 9 insertions, 8 deletions
diff --git a/tests/mock/MockChallengeResponseKey.cpp b/tests/mock/MockChallengeResponseKey.cpp
index c88b07fcc..9cfdc0501 100644
--- a/tests/mock/MockChallengeResponseKey.cpp
+++ b/tests/mock/MockChallengeResponseKey.cpp
@@ -17,8 +17,8 @@
#include "MockChallengeResponseKey.h"
-MockChallengeResponseKey::MockChallengeResponseKey(const QByteArray& response)
- : m_response(response)
+MockChallengeResponseKey::MockChallengeResponseKey(const QByteArray& secret)
+ : m_secret(secret)
{
}
@@ -28,12 +28,11 @@ MockChallengeResponseKey::~MockChallengeResponseKey()
QByteArray MockChallengeResponseKey::rawKey() const
{
- return m_response;
+ return m_challenge + m_secret;
}
bool MockChallengeResponseKey::challenge(const QByteArray& challenge)
{
- Q_UNUSED(challenge);
+ m_challenge = challenge;
return true;
}
-
diff --git a/tests/mock/MockChallengeResponseKey.h b/tests/mock/MockChallengeResponseKey.h
index 49963c93c..af795d935 100644
--- a/tests/mock/MockChallengeResponseKey.h
+++ b/tests/mock/MockChallengeResponseKey.h
@@ -21,18 +21,20 @@
#include "keys/ChallengeResponseKey.h"
/**
- * Mock challenge-response key implementation that simply returns the a fixed response.
+ * Mock challenge-response key implementation that simply
+ * returns the challenge concatenated with a fixed secret.
*/
class MockChallengeResponseKey : public ChallengeResponseKey
{
public:
- explicit MockChallengeResponseKey(const QByteArray& response);
+ explicit MockChallengeResponseKey(const QByteArray& secret);
~MockChallengeResponseKey() override;
QByteArray rawKey() const override;
bool challenge(const QByteArray& challenge) override;
private:
- QByteArray m_response;
+ QByteArray m_challenge;
+ QByteArray m_secret;
};
#endif //KEEPASSXC_MOCKCHALLENGERESPONSEKEY_H