[SOLVED] Cannot open website with https - OpenSSL Issue - Qt 5.4.1 - Mac OS X Yosemite 10.10.3



  • Hi Qt experts,

    I've just joined awesome Qt community recently. As part of learning QWebView and load "https://www.google.com".

    And I'm having a problem with getting Qt to work with SSL on mac OS X.
    ** Without SSL, the app works just fine with http://www.google.com

    Environment

    • Qt 5.4.1 - Installed with Installer
    • Mac OSX Yosemite 10.10.3
    • Qt Creator 3.4.0
    • Widget-based App

    Problem
    I get following errors, and the webpage is not loaded - just blank/white

    qt.network.ssl: QSslSocket: cannot resolve TLSv1_1_client_method
    qt.network.ssl: QSslSocket: cannot resolve TLSv1_2_client_method
    qt.network.ssl: QSslSocket: cannot resolve TLSv1_1_server_method
    qt.network.ssl: QSslSocket: cannot resolve TLSv1_2_server_method
    qt.network.ssl: QSslSocket: cannot resolve SSL_select_next_proto
    qt.network.ssl: QSslSocket: cannot resolve SSL_CTX_set_next_proto_select_cb
    qt.network.ssl: QSslSocket: cannot resolve SSL_get0_next_proto_negotiated
    

    After googling, all answers that I got so far point out that in Mac OS X, old version of openssl is used, and Qt 5.4.1 requires SSL 1.0 or newer. So I updated openssl - using home-brew.

    $openssl version
    OpenSSL 1.0.2 22 Jan 2015
    

    In my project .pro file, I have following setup

    macx: LIBS += -L$$PWD/../../../../../../../usr/local/Cellar/openssl/1.0.2/lib/ -lcrypto -lssl
    
    INCLUDEPATH += $$PWD/../../../../../../../usr/local/Cellar/openssl/1.0.2/include
    DEPENDPATH += $$PWD/../../../../../../../usr/local/Cellar/openssl/1.0.2/include
    

    In my codes, I added following codes for debugging

    qDebug() << "Support SSL:  " << QSslSocket::supportsSsl()
            << "\nLib Version Number: " << QSslSocket::sslLibraryVersionNumber()
            << "\nLib Version String: " << QSslSocket::sslLibraryVersionString()
            << "\nLib Build Version Number: " << QSslSocket::sslLibraryBuildVersionNumber()
            << "\nLib Build Version String: " << QSslSocket::sslLibraryBuildVersionString();
    

    and here is debug messages

    Support SSL:   true 
    Lib Version Number:  9470431 
    Lib Version String:  "OpenSSL 0.9.8zd 8 Jan 2015" 
    Lib Build Version Number:  268439727 
    Lib Build Version String:  "OpenSSL 1.0.1j 15 Oct 2014"
    

    Since I don't change the link to default openssl which is in /usr/bin/openssl.

    $which openssl
    /usr/local/Cellar/openssl/1.0.2/bin/openssl
    
    $whereis openssl
    /usr/bin/openssl
    

    Does it make Qt pick up "Lib Version String: "OpenSSL 0.9.8zd 8 Jan 2015"? And why Qt picks "OpenSSL 1.0.1j 15 Oct 2014" as well?

    Could someone point out what is wrong?

    Thanks,



  • HI and welcome to devnet,

    Qt has embedded support to openssl so you don't need to link the system openssl library.
    Using QtWebkit I have the same behaviour; using QtWebEngineView it works



  • @mcosta Thanks mcosta

    Yes, indeed I can show website over https with WebEngine, even though it still show those warning messages. As documented here, Web Kit will be deprecated in Qt version 5.5+, so I'll switch to use WebEngine then.

    For those who feel annoyed with the warning messages, you could suppress them by calling following method in your main()

    QLoggingCategory::setFilterRules("qt.network.ssl.w arning=false");
    

    or by setting environment variable

    QT_LOGGING_RULES=qt.network.ssl.warning=false
    

Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.