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
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
2025-02-09 01:21:36 +00:00
|
|
|
#include "FingerprintData.h"
|
2025-01-29 04:38:54 +00:00
|
|
|
|
|
|
|
|
#include <cstdint>
|
|
|
|
|
#include <openssl/ossl_typ.h>
|
2025-01-29 01:13:02 +00:00
|
|
|
#include <string>
|
2025-01-29 02:15:50 +00:00
|
|
|
#include <vector>
|
2025-01-29 01:13:02 +00:00
|
|
|
|
|
|
|
|
namespace deskflow {
|
|
|
|
|
|
2025-01-29 02:15:50 +00:00
|
|
|
/**
|
2025-01-29 01:13:02 +00:00
|
|
|
* @brief formatSSLFingerprint Format an ssl Fingerprint
|
|
|
|
|
* @param fingerprint input string
|
|
|
|
|
* @param enableSeparators insert : seperator every byte when true
|
|
|
|
|
* @return a Formated Fingerprint String
|
|
|
|
|
*/
|
2025-01-29 02:15:50 +00:00
|
|
|
std::string formatSSLFingerprint(const std::vector<uint8_t> &fingerprint, bool enableSeparators = true);
|
2025-01-29 01:13:02 +00:00
|
|
|
|
2025-02-09 02:42:19 +00:00
|
|
|
std::string formatSSLFingerprintColumns(const std::vector<uint8_t> &fingerprint);
|
|
|
|
|
|
2025-02-09 01:21:36 +00:00
|
|
|
FingerprintData sslCertFingerprint(X509 *cert, FingerprintType type);
|
2025-01-29 05:22:48 +00:00
|
|
|
|
2025-02-09 01:21:36 +00:00
|
|
|
FingerprintData pemFileCertFingerprint(const std::string &path, FingerprintType type);
|
2025-01-29 06:19:04 +00:00
|
|
|
|
|
|
|
|
void generatePemSelfSignedCert(const std::string &path, int keyLength = 2048);
|
|
|
|
|
|
|
|
|
|
int getCertLength(const std::string &path);
|
2025-02-09 02:42:19 +00:00
|
|
|
|
|
|
|
|
std::string generateFingerprintArt(const std::vector<std::uint8_t> &rawDigest);
|
2025-01-29 01:13:02 +00:00
|
|
|
} // namespace deskflow
|