Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Certificate error, [openssl] when debugging my app in android
QtWS25 Last Chance

Certificate error, [openssl] when debugging my app in android

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
4 Posts 2 Posters 355 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.
  • MesrineM Offline
    MesrineM Offline
    Mesrine
    wrote on last edited by Mesrine
    #1

    Hello everyone, I am trying to compile my cmake project to android and create an .apk.

    to do that I have added to CMake

    if(ANDROID)
            set_property(TARGET nftminter APPEND PROPERTY QT_ANDROID_MIN_SDK_VERSION 30)
            set_property(TARGET nftminter APPEND PROPERTY QT_ANDROID_TARGET_SDK_VERSION 30)
            set_property(TARGET nftminter APPEND PROPERTY QT_ANDROID_SDK_BUILD_TOOLS_REVISION 30)
    
            set_property(TARGET nftminter PROPERTY QT_ANDROID_EXTRA_LIBS
                /android_openssl/ssl_3/${CMAKE_ANDROID_ARCH_ABI}/libcrypto_3.so
                /android_openssl/ssl_3/${CMAKE_ANDROID_ARCH_ABI}/libssl_3.so)
    endif(ANDROID)
    

    The thing is that I have a websocket class like

    WebSocketIODevice::WebSocketIODevice(QObject *parent)
        : QIODevice(parent)
    {
        connect(&m_socket, &QWebSocket::connected, this, &WebSocketIODevice::onSocketConnected);
        connect(&m_socket, &QWebSocket::binaryMessageReceived, this, &WebSocketIODevice::handleBinaryMessage);
        connect(&m_socket,QOverload<QAbstractSocket::SocketError>::of(&QWebSocket::errorOccurred),this,
                [=](QAbstractSocket::SocketError error)
                {
                    qDebug()<<"error websocket:"<<error;
                    qDebug()<<"error:"<<m_socket.errorString();
                    qDebug() << "Device supports OpenSSL: " << QSslSocket::supportsSsl();
                    qDebug()<<"availableBackends:"<<QSslSocket::availableBackends();
                    qDebug()<<"activeBackend:"<<QSslSocket::activeBackend();
                    qDebug()<<"sslLibraryBuildVersionString():"<<QSslSocket::sslLibraryBuildVersionString();
                    qDebug()<<"sslLibraryVersionString():"<<QSslSocket::sslLibraryVersionString();
                    qDebug()<<"supportedFeatures():";
                    for(auto v:QSslSocket::supportedFeatures())
                    {
                        qDebug()<<int(v);
                    }
                    qDebug()<<"supportedProtocols():"<<QSslSocket::supportedProtocols();
                });
    }
    

    That is not working when I deploy to my physical device using QtCreator.
    The error that shows from the previous qDebugs are

    error websocket: QAbstractSocket::SocketError(13)
    error: "The issuer certificate of a locally looked up certificate could not be found"
    Device supports OpenSSL:  true
    availableBackends: QList("openssl", "cert-only")
     activeBackend: "openssl"
    sslLibraryBuildVersionString(): "OpenSSL 3.0.7 1 Nov 2022"
    sslLibraryVersionString(): "OpenSSL 3.1.1 30 May 2023"
    supportedFeatures():
    0
    1
    2
    3
    4
    5
    6
    supportedProtocols(): QList(3, 4, 0, 5, 1, 6, 2, 7, 12, 13, 8, 9, 10, 11)
    

    Also on the Application output when deploying the app to my phone it says

     qt.network.ssl: : No functional TLS backend was found
    W qt.network.ssl: : No functional TLS backend was found
    W qt.network.ssl: : No TLS backend is available
    

    EDIT
    My application perform QNetworkRequest s to servers API using https and this works okay on Android but the websocket class does not work(returns this certificate error).

    The thing is the app works in Desktop platforms and wasm, but not in Android( the websocket is not opened).

    Any help on this will be appreciated.

    Many thanks for your time.

    jsulmJ 1 Reply Last reply
    0
    • MesrineM Mesrine

      Hello everyone, I am trying to compile my cmake project to android and create an .apk.

      to do that I have added to CMake

      if(ANDROID)
              set_property(TARGET nftminter APPEND PROPERTY QT_ANDROID_MIN_SDK_VERSION 30)
              set_property(TARGET nftminter APPEND PROPERTY QT_ANDROID_TARGET_SDK_VERSION 30)
              set_property(TARGET nftminter APPEND PROPERTY QT_ANDROID_SDK_BUILD_TOOLS_REVISION 30)
      
              set_property(TARGET nftminter PROPERTY QT_ANDROID_EXTRA_LIBS
                  /android_openssl/ssl_3/${CMAKE_ANDROID_ARCH_ABI}/libcrypto_3.so
                  /android_openssl/ssl_3/${CMAKE_ANDROID_ARCH_ABI}/libssl_3.so)
      endif(ANDROID)
      

      The thing is that I have a websocket class like

      WebSocketIODevice::WebSocketIODevice(QObject *parent)
          : QIODevice(parent)
      {
          connect(&m_socket, &QWebSocket::connected, this, &WebSocketIODevice::onSocketConnected);
          connect(&m_socket, &QWebSocket::binaryMessageReceived, this, &WebSocketIODevice::handleBinaryMessage);
          connect(&m_socket,QOverload<QAbstractSocket::SocketError>::of(&QWebSocket::errorOccurred),this,
                  [=](QAbstractSocket::SocketError error)
                  {
                      qDebug()<<"error websocket:"<<error;
                      qDebug()<<"error:"<<m_socket.errorString();
                      qDebug() << "Device supports OpenSSL: " << QSslSocket::supportsSsl();
                      qDebug()<<"availableBackends:"<<QSslSocket::availableBackends();
                      qDebug()<<"activeBackend:"<<QSslSocket::activeBackend();
                      qDebug()<<"sslLibraryBuildVersionString():"<<QSslSocket::sslLibraryBuildVersionString();
                      qDebug()<<"sslLibraryVersionString():"<<QSslSocket::sslLibraryVersionString();
                      qDebug()<<"supportedFeatures():";
                      for(auto v:QSslSocket::supportedFeatures())
                      {
                          qDebug()<<int(v);
                      }
                      qDebug()<<"supportedProtocols():"<<QSslSocket::supportedProtocols();
                  });
      }
      

      That is not working when I deploy to my physical device using QtCreator.
      The error that shows from the previous qDebugs are

      error websocket: QAbstractSocket::SocketError(13)
      error: "The issuer certificate of a locally looked up certificate could not be found"
      Device supports OpenSSL:  true
      availableBackends: QList("openssl", "cert-only")
       activeBackend: "openssl"
      sslLibraryBuildVersionString(): "OpenSSL 3.0.7 1 Nov 2022"
      sslLibraryVersionString(): "OpenSSL 3.1.1 30 May 2023"
      supportedFeatures():
      0
      1
      2
      3
      4
      5
      6
      supportedProtocols(): QList(3, 4, 0, 5, 1, 6, 2, 7, 12, 13, 8, 9, 10, 11)
      

      Also on the Application output when deploying the app to my phone it says

       qt.network.ssl: : No functional TLS backend was found
      W qt.network.ssl: : No functional TLS backend was found
      W qt.network.ssl: : No TLS backend is available
      

      EDIT
      My application perform QNetworkRequest s to servers API using https and this works okay on Android but the websocket class does not work(returns this certificate error).

      The thing is the app works in Desktop platforms and wasm, but not in Android( the websocket is not opened).

      Any help on this will be appreciated.

      Many thanks for your time.

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @Mesrine Are the SSL libs also built for Android and correct architecture?

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      MesrineM 1 Reply Last reply
      0
      • jsulmJ jsulm

        @Mesrine Are the SSL libs also built for Android and correct architecture?

        MesrineM Offline
        MesrineM Offline
        Mesrine
        wrote on last edited by Mesrine
        #3

        @jsulm I hope so, these were downloaded by qtCreator and also has the CMAKE_ANDROID_ARCH_ABI(arm64-v8a) in the path name. I have added

        qDebug() << "Device supports OpenSSL: " << QSslSocket::supportsSsl();
        

        the output is

        Device supports OpenSSL:  true
        
        MesrineM 1 Reply Last reply
        0
        • MesrineM Mesrine

          @jsulm I hope so, these were downloaded by qtCreator and also has the CMAKE_ANDROID_ARCH_ABI(arm64-v8a) in the path name. I have added

          qDebug() << "Device supports OpenSSL: " << QSslSocket::supportsSsl();
          

          the output is

          Device supports OpenSSL:  true
          
          MesrineM Offline
          MesrineM Offline
          Mesrine
          wrote on last edited by
          #4

          @Mesrine

          My application now works. The issue is related to using pointers of QObject as static members of a QML custom type. These objects were the ones opening the sockets.

          1 Reply Last reply
          0

          • Login

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