Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Trouble with secure websockets
QtWS25 Last Chance

Trouble with secure websockets

Scheduled Pinned Locked Moved Unsolved General and Desktop
websocketserverwebsocketssl
8 Posts 2 Posters 5.0k Views
  • 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
    HTWAMD
    wrote on 2 Feb 2016, 13:20 last edited by
    #1

    Hey,

    I working with websockets at the moment based on the Qt examples: http://doc.qt.io/qt-5/qtwebsockets-examples.html
    I want to use the secure websockets now (wss) but I have trouble with the webclient.

    http://doc.qt.io/qt-5/qtwebsockets-sslechoserver-sslechoclient-html.html
    if I try to connect to the server, I get the following error:

    ERROR: undefined
    DISCONNECTED
    
    

    The key and cert file are created with openssl, using this 3 commands:

    openssl genrsa -out key.pem 2048
    openssl req -new -key key.pem -out csr.pem
    openssl req -x509 -days 365 -key key.pem -in csr.pem -out certificate.pem
    

    So I have no idea why the webclient can't connect. Maybe some handshake error but no idea why. Normal connections (ws://) working, websocket secure (wss://) not.
    Also the Echo-Client can connect without any problems.

    I tested the html file with Edge, Firefox, IE, Chrome, all fail. The browsers should be not the problem, I did the test on http://www.websocket.org/echo.html - working very well.

    I hope someone has an idea, I really need a solution for that problem.

    1 Reply Last reply
    0
    • H Offline
      H Offline
      HTWAMD
      wrote on 3 Feb 2016, 07:54 last edited by
      #2

      Push

      If I try to connect to the server with the webclient, I get the following message from the server every time:

      qt.network.ssl: QSslSocket: cannot call unresolved function SSL_get0_next_proto_negotiated
      

      Maybe that information helps.

      1 Reply Last reply
      0
      • S Offline
        S Offline
        SGaist
        Lifetime Qt Champion
        wrote on 3 Feb 2016, 23:01 last edited by
        #3

        Hi and welcome to devnet,

        What OS are you running ?

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply
        0
        • H Offline
          H Offline
          HTWAMD
          wrote on 4 Feb 2016, 18:38 last edited by
          #4

          Windows 10 Education X64 - Qt 5.5.1

          1 Reply Last reply
          0
          • S Offline
            S Offline
            SGaist
            Lifetime Qt Champion
            wrote on 4 Feb 2016, 20:43 last edited by
            #5

            Do you have OpenSSL-Win64 installed on your computer ?

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            1 Reply Last reply
            0
            • H Offline
              H Offline
              HTWAMD
              wrote on 8 Feb 2016, 14:07 last edited by HTWAMD 2 Aug 2016, 14:08
              #6

              Yes, I installed OpenSSL from here OpenSSL
              I'm using Version 1.0.2f - after the installation I got no more warnings in console but still no way to connect with the webclient.

              1 Reply Last reply
              0
              • S Offline
                S Offline
                SGaist
                Lifetime Qt Champion
                wrote on 8 Feb 2016, 21:08 last edited by
                #7

                Good, so next thing: did you add the path to the OpenSSL-Win64 dlls to the PATH environment variable in the run settings from the Project panel ? Warning: Don't do it system wide, that's wrong.

                Interested in AI ? www.idiap.ch
                Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                1 Reply Last reply
                0
                • H Offline
                  H Offline
                  HTWAMD
                  wrote on 11 Feb 2016, 21:22 last edited by HTWAMD 2 Dec 2016, 15:22
                  #8

                  I didn't.
                  But also it didn't fixed the error.

                  The QT client can connect to the server with wss.
                  The Webclient can't connect to the server with wss. But an echo test to "wss://echo.websocket.org" is successfully, so the browser is okay. The question is, what's the difference between Qt secure websocket and the other solutions? Is it may some different SSL/TSL config?
                  I'm using QSsl::TlsV1SslV3

                  1 Reply Last reply
                  0

                  1/8

                  2 Feb 2016, 13:20

                  • Login

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