chore: SecureUtils::generatePemSelfSignedCert take QString for path

This commit is contained in:
sithlord48 2025-12-05 15:52:40 -05:00 committed by Nick Bolton
parent 2d682d9151
commit cb4621cad7
3 changed files with 4 additions and 6 deletions

View file

@ -115,7 +115,7 @@ bool generateCertificate()
} }
try { try {
deskflow::generatePemSelfSignedCert(certPath.toStdString(), keyLength); deskflow::generatePemSelfSignedCert(certPath, keyLength);
} catch (const std::exception &e) { } catch (const std::exception &e) {
qCritical() << "failed to generate self-signed pem cert: " << e.what(); qCritical() << "failed to generate self-signed pem cert: " << e.what();
return false; return false;

View file

@ -62,7 +62,7 @@ Fingerprint sslCertFingerprint(const X509 *cert, QCryptographicHash::Algorithm t
return {type, digestArray}; return {type, digestArray};
} }
void generatePemSelfSignedCert(const std::string &path, int keyLength) void generatePemSelfSignedCert(const QString &path, int keyLength)
{ {
auto expirationDays = 365; auto expirationDays = 365;
@ -91,7 +91,7 @@ void generatePemSelfSignedCert(const std::string &path, int keyLength)
X509_sign(cert, privateKey, EVP_sha256()); X509_sign(cert, privateKey, EVP_sha256());
auto fp = fopenUtf8Path(path.c_str(), "w"); auto fp = fopenUtf8Path(path.toStdString().c_str(), "w");
if (!fp) { if (!fp) {
throw std::runtime_error("could not open certificate output path"); throw std::runtime_error("could not open certificate output path");
} }

View file

@ -11,8 +11,6 @@
#include <openssl/x509.h> #include <openssl/x509.h>
#include <string>
namespace deskflow { namespace deskflow {
/** /**
@ -27,7 +25,7 @@ QString formatSSLFingerprintColumns(const QByteArray &fingerprint);
Fingerprint sslCertFingerprint(const X509 *cert, QCryptographicHash::Algorithm type); Fingerprint sslCertFingerprint(const X509 *cert, QCryptographicHash::Algorithm type);
void generatePemSelfSignedCert(const std::string &path, int keyLength = 2048); void generatePemSelfSignedCert(const QString &path, int keyLength = 2048);
QString generateFingerprintArt(const QByteArray &rawDigest); QString generateFingerprintArt(const QByteArray &rawDigest);
} // namespace deskflow } // namespace deskflow