Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Qt Android OpenSSL issues



  • Yeah, I've been reading and researching and compiling and recompiling... and still getting SSL errors since upgrading to 5.12x

    My config:
    Qt Creator 4.9.2
    Based on Qt 5.12.4 (Clang 10.0 (Apple), 64 bit)
    Built on Jun 26 2019 11:30:44
    From revision 8181363fa9

    Compiling against NDK 19c

    QSslSocket::sslLibraryBuildVersionString() returns "OpenSSL 1.1.1b 26 Feb 2019"

    I've used the link provided at: https://doc.qt.io/qt-5/android-openssl-support.html:

    https://github.com/KDAB/android_openssl

    To grab the latest OpenSSL (but 1.1.1b instead of 1.1.1c).... rebuild, rebuild, clean, rebuild... and I still get this when accessing HTTPS files:

    E linker  : library "/system/lib/libcrypto.so" ("/system/lib/libcrypto.so") needed or dlopened by "/data/app/org.qtproject.example.markFinder-F4cbyaIXcBlklUMR3Eav2w==/lib/arm64/libQt5Core.so" is not accessible for the namespace: [name="classloader-namespace", ld_library_paths="", default_library_paths="/data/app/org.qtproject.example.markFinder-F4cbyaIXcBlklUMR3Eav2w==/lib/arm64:/data/app/org.qtproject.example.markFinder-F4cbyaIXcBlklUMR3Eav2w==/base.apk!/lib/arm64-v8a", permitted_paths="/data:/mnt/expand:/data/data/org.qtproject.example.markFinder"]
    

    And:

    W btstWx_map: qt.network.ssl: QSslSocket::connectToHostEncrypted: TLS initialization failed
    

    Anyone have any ideas why?!



  • Yes, I have this to include the PRI:

    android {
        include(openSSL/openssl.pri)
    }
    

    And, I've included it in my Project as well. Same as I used to do with the older version of SSL.

    -----------UPDATE
    Had two PRO files confused... correctly adding in the INCLUDE of the ssl PRI file worked.


  • Lifetime Qt Champion

    Hi,

    Did you properly deploy the library with your application ?



  • I have it reference in my PRO file like I always have.

    App PRO:

    android {
        DISTFILES += \
            android/AndroidManifest.xml \
            ANDROID_PACKAGE_SOURCE_DIR = $$PWD/android \
            openSSL/openssl.pri
    }
    

    openssl.pri:

    contains(ANDROID_TARGET_ARCH,armeabi-v7a) {
        ANDROID_EXTRA_LIBS += \
            $$PWD/arm/libcrypto.so \
            $$PWD/arm/libssl.so
    }
    
    contains(ANDROID_TARGET_ARCH,arm64-v8a) {
        ANDROID_EXTRA_LIBS += \
            $$PWD/arm64/libcrypto.so \
            $$PWD/arm64/libssl.so
    }
    
    contains(ANDROID_TARGET_ARCH,x86) {
        ANDROID_EXTRA_LIBS += \
            $$PWD/x86/libcrypto.so \
            $$PWD/x86/libssl.so
    }
    
    contains(ANDROID_TARGET_ARCH,x86_64) {
        ANDROID_EXTRA_LIBS += \
            $$PWD/x86_64/libcrypto.so \
            $$PWD/x86_64/libssl.so
    }
    

  • Lifetime Qt Champion

    Which exact version of Qt ? The switch to OpenSSL 1.1 in the official binary happened for Qt 5.12.4.



  • Qt Creator 4.9.2
    Based on Qt 5.12.4 (Clang 10.0 (Apple), 64 bit)
    Built on Jun 26 2019 11:30:44
    From revision 8181363fa9

    Knew there were OpenSSL issues, so I updated this past week.


  • Lifetime Qt Champion

    That's the Qt Creator information. I am asking for the Qt version you are using to build your application.



  • 0_1567516934969_31413429-10f2-4b49-bca6-a1518fcbe66b-image.png

    5.12.4, right?


  • Lifetime Qt Champion

    Indeed, it just realised something. From the .pro file bits you posted, you only have openssl.pri in DISTFILES. Do you include it at some point ? Otherwise, it's content won't be processed.



  • Yes, I have this to include the PRI:

    android {
        include(openSSL/openssl.pri)
    }
    

    And, I've included it in my Project as well. Same as I used to do with the older version of SSL.

    -----------UPDATE
    Had two PRO files confused... correctly adding in the INCLUDE of the ssl PRI file worked.


  • Lifetime Qt Champion

    What version of Android are you targeting ?



  • 0_1567524652249_e2a729af-4b49-45b7-a0b9-09499d776835-image.png



  • Just to make sure, you are not trying this on an Android 5.x device? As it's not gonna work with openSSL 1.1.x



  • Current test device is Android 9. LG V50 ThinQ


Log in to reply