2014-05-26 02:06:26 -07:00
|
|
|
/*
|
2019-02-21 22:28:45 +01:00
|
|
|
* Copyright (C) 2019 KeePassXC Team <team@keepassxc.org>
|
2018-03-01 20:07:19 +01:00
|
|
|
*
|
|
|
|
* 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/>.
|
2018-11-01 04:27:38 +01:00
|
|
|
*/
|
2014-05-26 02:06:26 -07:00
|
|
|
|
|
|
|
#ifndef KEEPASSX_YK_CHALLENGERESPONSEKEY_H
|
|
|
|
#define KEEPASSX_YK_CHALLENGERESPONSEKEY_H
|
|
|
|
|
|
|
|
#include "core/Global.h"
|
|
|
|
#include "keys/ChallengeResponseKey.h"
|
|
|
|
#include "keys/drivers/YubiKey.h"
|
|
|
|
|
2017-02-23 23:52:36 +01:00
|
|
|
#include <QObject>
|
|
|
|
|
|
|
|
class YkChallengeResponseKey : public QObject, public ChallengeResponseKey
|
2014-05-26 02:06:26 -07:00
|
|
|
{
|
2017-02-23 23:52:36 +01:00
|
|
|
Q_OBJECT
|
|
|
|
|
2014-05-26 02:06:26 -07:00
|
|
|
public:
|
2018-05-13 23:21:43 +02:00
|
|
|
static QUuid UUID;
|
2014-05-26 02:06:26 -07:00
|
|
|
|
2018-05-13 23:21:43 +02:00
|
|
|
explicit YkChallengeResponseKey(int slot = -1, bool blocking = false);
|
2019-02-21 22:28:45 +01:00
|
|
|
~YkChallengeResponseKey() override;
|
2018-05-13 23:21:43 +02:00
|
|
|
|
|
|
|
QByteArray rawKey() const override;
|
|
|
|
bool challenge(const QByteArray& challenge) override;
|
2018-10-30 17:17:52 -04:00
|
|
|
bool challenge(const QByteArray& challenge, unsigned int retries);
|
2014-05-26 02:06:26 -07:00
|
|
|
QString getName() const;
|
|
|
|
bool isBlocking() const;
|
|
|
|
|
2017-02-23 23:52:36 +01:00
|
|
|
signals:
|
|
|
|
/**
|
|
|
|
* Emitted whenever user interaction is required to proceed with the challenge-response protocol.
|
|
|
|
* You can use this to show a helpful dialog informing the user that his assistance is required.
|
|
|
|
*/
|
|
|
|
void userInteractionRequired();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Emitted when the user has provided their required input.
|
|
|
|
*/
|
|
|
|
void userConfirmed();
|
|
|
|
|
2014-05-26 02:06:26 -07:00
|
|
|
private:
|
2019-02-21 22:28:45 +01:00
|
|
|
char* m_key = nullptr;
|
|
|
|
std::size_t m_keySize = 0;
|
2014-05-26 02:06:26 -07:00
|
|
|
int m_slot;
|
|
|
|
bool m_blocking;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // KEEPASSX_YK_CHALLENGERESPONSEKEY_H
|