mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-05-04 07:35:23 -04:00
Fix challenge-response key data after Botan
* Fix #6420 * Refactor Challenge-Response key files to be more streamlined. Added a test to confirm raw key data is accurate.
This commit is contained in:
parent
60adcacaaa
commit
fd0bdaae80
14 changed files with 65 additions and 108 deletions
|
@ -22,8 +22,9 @@
|
|||
|
||||
#include "core/Tools.h"
|
||||
#include "crypto/Crypto.h"
|
||||
#include "keys/YkChallengeResponseKey.h"
|
||||
#include "keys/ChallengeResponseKey.h"
|
||||
|
||||
#include <QCryptographicHash>
|
||||
#include <QScopedPointer>
|
||||
#include <QSignalSpy>
|
||||
|
||||
|
@ -50,7 +51,7 @@ void TestYubiKeyChallengeResponse::testDetectDevices()
|
|||
// Look at the information retrieved from the key(s)
|
||||
for (auto key : YubiKey::instance()->foundKeys()) {
|
||||
auto displayName = YubiKey::instance()->getDisplayName(key);
|
||||
QVERIFY(displayName.contains("Challenge Response - Slot") || displayName.contains("Configured Slot -"));
|
||||
QVERIFY(displayName.contains("Challenge-Response - Slot") || displayName.contains("Configured Slot -"));
|
||||
QVERIFY(displayName.contains(QString::number(key.first)));
|
||||
QVERIFY(displayName.contains(QString::number(key.second)));
|
||||
}
|
||||
|
@ -84,9 +85,11 @@ void TestYubiKeyChallengeResponse::testKeyChallenge()
|
|||
QSKIP("No YubiKey contains a slot in passive mode.");
|
||||
}
|
||||
|
||||
QScopedPointer<YkChallengeResponseKey> key(new YkChallengeResponseKey(pKey));
|
||||
QScopedPointer<ChallengeResponseKey> key(new ChallengeResponseKey(pKey));
|
||||
|
||||
QByteArray ba("UnitTest");
|
||||
QVERIFY(key->challenge(ba));
|
||||
QCOMPARE(key->rawKey().size(), 20UL);
|
||||
QCOMPARE(key->rawKey().size(), 20);
|
||||
auto hash = QString(QCryptographicHash::hash(key->rawKey(), QCryptographicHash::Sha256).toHex());
|
||||
QCOMPARE(hash, QString("2f7802c7112c301303526e7737b54d546c905076dca6e9538edf761a2264cd70"));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue