Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. [SOLVED] Cannot open website with https - OpenSSL Issue - Qt 5.4.1 - Mac OS X Yosemite 10.10.3
Forum Updated to NodeBB v4.3 + New Features

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

Scheduled Pinned Locked Moved Installation and Deployment
openssl5.4.1osx
3 Posts 2 Posters 8.5k Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Offline
    H Offline
    Hoa Ho
    wrote on last edited by Hoa Ho
    #1

    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,

    1 Reply Last reply
    0
    • M Offline
      M Offline
      mcosta
      wrote on last edited by
      #2

      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

      Once your problem is solved don't forget to:

      • Mark the thread as SOLVED using the Topic Tool menu
      • Vote up the answer(s) that helped you to solve the issue

      You can embed images using (http://imgur.com/) or (http://postimage.org/)

      H 1 Reply Last reply
      1
      • M mcosta

        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

        H Offline
        H Offline
        Hoa Ho
        wrote on last edited by
        #3

        @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
        
        1 Reply Last reply
        1

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved