Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

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

    Installation and Deployment
    openssl 5.4.1 osx
    2
    3
    8077
    Loading More Posts
    • 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
      Hoa Ho last edited by Hoa Ho

      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 Reply Quote 0
      • M
        mcosta last edited by

        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 Reply Quote 1
        • H
          Hoa Ho @mcosta last edited by

          @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 Reply Quote 1
          • First post
            Last post