2025-01-29 01:13:02 +00:00
|
|
|
/*
|
|
|
|
|
* Deskflow -- mouse and keyboard sharing utility
|
|
|
|
|
* SPDX-FileCopyrightText: (C) 2025 Deskflow Developers
|
|
|
|
|
* SPDX-FileCopyrightText: (C) 2021 Barrier Contributors
|
|
|
|
|
* SPDX-License-Identifier: GPL-2.0-only WITH LicenseRef-OpenSSL-Exception
|
|
|
|
|
*/
|
|
|
|
|
|
2025-04-08 22:04:21 +00:00
|
|
|
#include "SecureUtilsTests.h"
|
2025-01-29 01:13:02 +00:00
|
|
|
|
2025-04-08 22:04:21 +00:00
|
|
|
#include "../../lib/net/SecureUtils.h"
|
2025-01-29 01:13:02 +00:00
|
|
|
|
2025-04-08 22:04:21 +00:00
|
|
|
using namespace deskflow;
|
|
|
|
|
|
|
|
|
|
void SecureUtilsTests::checkHex()
|
2025-01-29 01:13:02 +00:00
|
|
|
{
|
2025-01-29 02:15:50 +00:00
|
|
|
std::vector<uint8_t> fingerprint = {40, 253, 10, 152, 138, 14, 161, 108, 215, 232, 108, 167, 238, 88, 65, 113,
|
|
|
|
|
202, 178, 142, 73, 37, 148, 144, 37, 38, 5, 141, 175, 99, 237, 46, 48};
|
2025-01-29 01:13:02 +00:00
|
|
|
|
2025-04-08 22:04:21 +00:00
|
|
|
QCOMPARE(
|
2025-01-29 02:15:50 +00:00
|
|
|
deskflow::formatSSLFingerprint(fingerprint, true),
|
|
|
|
|
"28:FD:0A:98:8A:0E:A1:6C:D7:E8:6C:A7:EE:58:41:71:CA:B2:8E:49:25:94:90:25:26:05:8D:AF:63:ED:2E:30"
|
2025-01-29 01:13:02 +00:00
|
|
|
);
|
|
|
|
|
}
|
2025-02-09 02:42:19 +00:00
|
|
|
|
2025-04-08 22:04:21 +00:00
|
|
|
void SecureUtilsTests::checkArt()
|
2025-02-09 02:42:19 +00:00
|
|
|
{
|
|
|
|
|
std::vector<uint8_t> fingerprint = {40, 253, 10, 152, 138, 14, 161, 108, 215, 232, 108, 167, 238, 88, 65, 113,
|
|
|
|
|
202, 178, 142, 73, 37, 148, 144, 37, 38, 5, 141, 175, 99, 237, 46, 48};
|
2025-04-08 22:04:21 +00:00
|
|
|
QCOMPARE(
|
2025-02-09 02:42:19 +00:00
|
|
|
deskflow::generateFingerprintArt(fingerprint), "╔═════════════════╗\n"
|
|
|
|
|
"║*X+. . ║\n"
|
|
|
|
|
"║*oo + ║\n"
|
|
|
|
|
"║ + = ║\n"
|
|
|
|
|
"║ B . . ║\n"
|
|
|
|
|
"║.+... o S ║\n"
|
|
|
|
|
"║E+ ++. . ║\n"
|
|
|
|
|
"║B*++.. . ║\n"
|
|
|
|
|
"║+o*o o . ║\n"
|
|
|
|
|
"║+o*Bo . ║\n"
|
|
|
|
|
"╚═════════════════╝"
|
|
|
|
|
);
|
|
|
|
|
}
|
2025-04-08 22:04:21 +00:00
|
|
|
|
|
|
|
|
QTEST_MAIN(SecureUtilsTests)
|