Results 1 to 4 of 4

Thread: Server connection problem using OpenSSL with android

  1. #1
    Join Date
    Aug 2012
    Posts
    6
    Qt products
    Qt4

    Default Server connection problem using OpenSSL with android

    Hi everyone,

    I'm developing for the first time a mobile application with Qt 5.8 based on a existing project.
    I'm using a smartphone Samsung Galaxy S5 SM-G901F with Android 6.0.1 for debug.

    I need to connect to a server with OpenSSL. I'm using OpenSSL 1.0.2k on Windows.
    When I compile the project with MSVC2015 and Qt Creator, no connexion problem.
    But when I compile this project for Android et execute on my smartphone, I can't connect (error : Diffie-Hellman parameters are not valid)

    I've tried to compile OpenSSL to include .so files directly in the APK.
    I've read the Qt tutorial http://doc.qt.io/qt-5/opensslsupport.html but it is for Qt 5.9 so I hope it's also a solution for Qt 5.8 but I'm not sure.
    I've installed MSYS-1.0.11 and Perl 5.26 and tried to compile the OpenSSL 1.0.2h (compatible with Qt 5.8) source code.
    Unfortunately, I'm stucked here :
    openSSL.jpg


    Did anyone try to compile these librairies ?
    Is that the goodsolution to solve my problem ?
    Is there any compatibility problem between the components I've installed ?

    The previous programmer in charge of this project told me he had no problem to connect to the serveur with a HTC One. I didn't need to include the librairies in the APK
    He borowed me this phone but I can't use it on my computer to test because it's not detected :/
    The HTC One has Android 5.0.2 installed.
    Is there a known issue with Android 6 ?

    I need your help please
    Thank you

  2. #2
    Join Date
    May 2009
    Location
    Canada
    Posts
    163
    Thanks
    7
    Thanked 20 Times in 20 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Windows Android

    Default Re: Server connection problem using OpenSSL with android

    I haven't anything to offer in the way of a solution.

    However, what I can do is confirm that I have the same problem (i.e., Diffie-Helman) on a Nexus 5 running Android 6.0.1, but no problem on a Nexus 7 running Android 5.1.

    It looks like this might be an "out of scope" bug with Qt 5.8: https://bugreports.qt.io/browse/QTBUG-59321. I was hoping to avoid upgrading from 5.8 to 5.9 until my project is released but it would seem that upgrading is worth a shot after all.

  3. #3
    Join Date
    Aug 2012
    Posts
    6
    Qt products
    Qt4

    Default Re: Server connection problem using OpenSSL with android

    Thank you for your reply.
    It's good to know I'm not the only one concerned by this issue.

    I'm still trying to solve this problem. I'll let you know if I achieve to do it

  4. #4
    Join Date
    May 2009
    Location
    Canada
    Posts
    163
    Thanks
    7
    Thanked 20 Times in 20 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Windows Android

    Default Re: Server connection problem using OpenSSL with android

    Well, the good news is that after updating to 5.9, I no longer have any issues downloading files on either of the Android devices mentioned.

    The bad news is that after updating to 5.9, downloading fails on my iOS device with the error: "SSL handshake failed".

    update: Here is one solution for the now-broken iOS downloads:

    Qt Code:
    1. QNetworkRequest request(url);
    2. #if QT_VERSION == QT_VERSION_CHECK(5, 9, 0) && defined Q_OS_IOS
    3. QSslConfiguration sslConf = request.sslConfiguration();
    4. sslConf.setPeerVerifyMode(QSslSocket::VerifyNone);
    5. request.setSslConfiguration(sslConf);
    6. #endif
    To copy to clipboard, switch view to plain text mode 

    (care of the discussion here: https://stackoverflow.com/questions/...ndshake-failed)

    Unrelated: for anyone updating to 5.9 (or from any version to any version, really), remember to review your UI. After updating to 5.9, my views look different (and not in a good way). >.<
    Last edited by Urthas; 27th June 2017 at 19:28.

Similar Threads

  1. Libusb device Connection In Qt-Android-Emulator
    By saad_saadi in forum Qt for Embedded and Mobile
    Replies: 0
    Last Post: 30th June 2015, 03:53
  2. How to create a SIP connection with Qt for Android?
    By rostamiani in forum Qt for Embedded and Mobile
    Replies: 3
    Last Post: 11th June 2015, 09:05
  3. Replies: 2
    Last Post: 21st August 2014, 20:36
  4. Replies: 0
    Last Post: 11th November 2011, 20:18
  5. web server connection
    By sattu in forum Qt Programming
    Replies: 2
    Last Post: 3rd March 2011, 12:44

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.