Add additional KDBX4 upgrade tests for composite key integrity

This commit is contained in:
Janek Bevendorff
2018-03-01 21:25:29 +01:00
committed by Jonathan White
parent e6c19fdcb1
commit 199f0932bf
7 changed files with 125 additions and 13 deletions

View File

@@ -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;
}

View File

@@ -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