refactor: add ssl consts into common/constansts

This commit is contained in:
sithlord48 2025-02-08 12:09:34 -05:00 committed by Nick Bolton
parent e257501072
commit 298b1047c4
3 changed files with 7 additions and 9 deletions

View file

@ -25,3 +25,8 @@ const auto kDebugBuild = true;
#else
const auto kDebugBuild = false;
#endif
const auto kSslDir = "tls";
const auto kCertificateFilename = "@CMAKE_PROJECT_NAME@.pem";
const auto kFingerprintTrustedServersFilename = "trusted-servers";

View file

@ -13,10 +13,6 @@
#include <QStandardPaths>
#include <QString>
// TODO: Reduce duplication of these strings between here and SecureSocket.cpp
const auto kCertificateFilename = QStringLiteral("%1.pem").arg(kAppId);
const auto kSslDir = "tls";
namespace deskflow::gui::paths {
/**

View file

@ -13,6 +13,7 @@
#include "base/Path.h"
#include "base/String.h"
#include "base/TMethodEventJob.h"
#include "common/constants.h"
#include "mt/Lock.h"
#include "net/TCPSocket.h"
#include "net/TSocketMultiplexerMethodJob.h"
@ -42,10 +43,6 @@ enum
kMsgSize = 128
};
// TODO: Reduce duplication of these strings between here and TlsFingerprint.cpp
static const char kFingerprintDirName[] = "tls";
static const char kFingerprintTrustedServersFilename[] = "trusted-servers";
struct Ssl
{
SSL_CTX *m_context;
@ -629,7 +626,7 @@ bool SecureSocket::verifyCertFingerprint()
std::string trustedServersFilename;
trustedServersFilename = deskflow::string::sprintf(
"%s/%s/%s", ARCH->getProfileDirectory().c_str(), kFingerprintDirName, kFingerprintTrustedServersFilename
"%s/%s/%s", ARCH->getProfileDirectory().c_str(), kSslDir, kFingerprintTrustedServersFilename
);
// check if this fingerprint exist