openssl fixes for windows
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@ -52,3 +52,4 @@ compile_commands.json
|
||||
*creator.user*
|
||||
|
||||
*_qmlcache.qrc
|
||||
build/
|
@ -22,13 +22,20 @@ add_executable(flotten-updater
|
||||
setarbitraryapikeydialog.ui
|
||||
)
|
||||
|
||||
find_package(OpenSSL)
|
||||
if (OpenSSL_Found)
|
||||
target_compile_definitions(flotten-updater HAS_OPENSSL)
|
||||
target_link_libraries(flotten-updater PUBLIC
|
||||
OpenSSL::SSL
|
||||
OpenSSL::Crypto
|
||||
)
|
||||
endif()
|
||||
|
||||
target_link_libraries(flotten-updater PUBLIC
|
||||
Qt6::Core
|
||||
Qt6::Gui
|
||||
Qt6::Widgets
|
||||
Qt6::WebSockets
|
||||
ssl
|
||||
crypto
|
||||
goecommon
|
||||
)
|
||||
|
||||
|
@ -7,11 +7,15 @@
|
||||
#include <QInputDialog>
|
||||
#include <QSslSocket>
|
||||
|
||||
#ifdef HAS_OPENSSL
|
||||
#include <openssl/provider.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAS_OPENSSL
|
||||
namespace {
|
||||
OSSL_PROVIDER *legacy{};
|
||||
}
|
||||
#endif
|
||||
|
||||
ImportCertificateDialog::ImportCertificateDialog(QWidget *parent) :
|
||||
QDialog{parent},
|
||||
@ -70,12 +74,14 @@ void ImportCertificateDialog::loadP12File()
|
||||
QSslCertificate cert;
|
||||
QList<QSslCertificate> certChain;
|
||||
|
||||
#ifdef HAS_OPENSSL
|
||||
if (QSslSocket::activeBackend() == "openssl" && !legacy)
|
||||
{
|
||||
legacy = OSSL_PROVIDER_load(NULL, "legacy");
|
||||
if (!legacy)
|
||||
QMessageBox::warning(this, tr("Failed to load openssl legacy provider!"), tr("Failed to load openssl legacy provider!"));
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!QSslCertificate::importPkcs12(&file, &key, &cert, &certChain, password))
|
||||
{
|
||||
|
Reference in New Issue
Block a user