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 22:07:19 +0300
committerJonathan White <droidmonkey@users.noreply.github.com>2018-03-02 03:26:18 +0300
commite6c19fdcb1d35e167839435a42b0eeb52488f453 (patch)
treef48128662707a73a3c54a30637b74801a6c77ba1 /tests/mock
parent6f6a63f5e9d2449d0186c5c7633e31885c65d488 (diff)
Add MockChallengeResponseKey and additional composite key component test
Diffstat (limited to 'tests/mock')
-rw-r--r--tests/mock/MockChallengeResponseKey.cpp39
-rw-r--r--tests/mock/MockChallengeResponseKey.h38
2 files changed, 77 insertions, 0 deletions
diff --git a/tests/mock/MockChallengeResponseKey.cpp b/tests/mock/MockChallengeResponseKey.cpp
new file mode 100644
index 000000000..c88b07fcc
--- /dev/null
+++ b/tests/mock/MockChallengeResponseKey.cpp
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2018 KeePassXC Team <team@keepassxc.org>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 or (at your option)
+ * version 3 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "MockChallengeResponseKey.h"
+
+MockChallengeResponseKey::MockChallengeResponseKey(const QByteArray& response)
+ : m_response(response)
+{
+}
+
+MockChallengeResponseKey::~MockChallengeResponseKey()
+{
+}
+
+QByteArray MockChallengeResponseKey::rawKey() const
+{
+ return m_response;
+}
+
+bool MockChallengeResponseKey::challenge(const QByteArray& challenge)
+{
+ Q_UNUSED(challenge);
+ return true;
+}
+
diff --git a/tests/mock/MockChallengeResponseKey.h b/tests/mock/MockChallengeResponseKey.h
new file mode 100644
index 000000000..49963c93c
--- /dev/null
+++ b/tests/mock/MockChallengeResponseKey.h
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2018 KeePassXC Team <team@keepassxc.org>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 or (at your option)
+ * version 3 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef KEEPASSXC_MOCKCHALLENGERESPONSEKEY_H
+#define KEEPASSXC_MOCKCHALLENGERESPONSEKEY_H
+
+#include "keys/ChallengeResponseKey.h"
+
+/**
+ * Mock challenge-response key implementation that simply returns the a fixed response.
+ */
+class MockChallengeResponseKey : public ChallengeResponseKey
+{
+public:
+ explicit MockChallengeResponseKey(const QByteArray& response);
+ ~MockChallengeResponseKey() override;
+ QByteArray rawKey() const override;
+ bool challenge(const QByteArray& challenge) override;
+
+private:
+ QByteArray m_response;
+};
+
+#endif //KEEPASSXC_MOCKCHALLENGERESPONSEKEY_H