Certificate error, [openssl] when debugging my app in android
-
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 areerror 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.
-
@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