Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
QCA on Android
-
Hi
I need OpenPGP to encrypt password, so I've choosend QCA (Qt Cryptographic Architecture)
https://github.com/KDE/qca
On Linux there is no problem, for Android I did cross compiled it with command:cmake . -DCMAKE_SYSTEM_NAME=Android -DCMAKE_TOOLCHAIN_FILE=/opt/Android/Ndk/android-ndk-r20/build/cmake/android.toolchain.cmake -DQt5_DIR=/opt/Felgo/Felgo/android_armv7/lib/cmake/Qt5/ -DQt5Core_DIR=/opt/Felgo/Felgo/android_armv7/lib/cmake/Qt5Core/ -DQt5Test_DIR=/opt/Felgo/Felgo/android_armv7/lib/cmake/Qt5Test/ -DQt5Network_DIR=/opt/Felgo/Felgo/android_armv7/lib/cmake/Qt5Network/ -DANDROID_PLATFORM=android-29 -DCMAKE_INSTALL_PREFIX=/usr/local/android -DUSE_RELATIVE_PATHS=ON
Config says the package relocatable
-- Check for working C compiler: /opt/Android/Ndk/android-ndk-r20/toolchains/llvm/prebuilt/linux-x86_64/bin/clang -- Check for working C compiler: /opt/Android/Ndk/android-ndk-r20/toolchains/llvm/prebuilt/linux-x86_64/bin/clang -- works -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Detecting C compile features -- Detecting C compile features - done -- Check for working CXX compiler: /opt/Android/Ndk/android-ndk-r20/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ -- Check for working CXX compiler: /opt/Android/Ndk/android-ndk-r20/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Detecting CXX compile features -- Detecting CXX compile features - done CMake Deprecation Warning at CMakeLists.txt:19 (cmake_policy): The OLD behavior for policy CMP0042 will be removed from a future version of CMake. The cmake-policies(7) manual explains that the OLD behaviors of all policies are deprecated and that a policy should be set to OLD only under specific short-term circumstances. Projects should be ported to the NEW behavior and not rely on setting a policy to OLD. -- Found Doxygen: /usr/bin/doxygen (found version "1.8.13") found components: doxygen dot -- Installed package is relocatable -- Checking for certstore.. -- Found system certstore -- certstore path: /etc/ssl/certs/ca-certificates.crt -- Looking for include file sys/filio.h -- Looking for include file sys/filio.h - not found -- Performing Test MLOCK_TAKES_VOID -- Performing Test MLOCK_TAKES_VOID - Success -- Found PkgConfig: /usr/bin/pkg-config (found version "0.29") -- Checking for module 'botan-2' -- No package 'botan-2' found -- Checking for module 'nss' -- No package 'nss' found -- Could NOT find OpenSSL, try to set the path to OpenSSL root folder in the system variable OPENSSL_ROOT_DIR (missing: OPENSSL_CRYPTO_LIBRARY OPENSSL_INCLUDE_DIR) (Required is at least version "1.1.1") -- Could NOT find OpenSSL, try to set the path to OpenSSL root folder in the system variable OPENSSL_ROOT_DIR (missing: OPENSSL_CRYPTO_LIBRARY OPENSSL_INCLUDE_DIR) -- Checking for one of the modules 'libpkcs11-helper-1' Plugins: qca-botan off qca-cyrus-sasl off qca-gcrypt off qca-gnupg on qca-logger on qca-nss off qca-ossl off qca-pkcs11 off qca-softstore on QCA prefix is /usr/local/android Plugins will be installed to /usr/local/android/lib/qca-qt5 Binary will be installed to /usr/local/android/bin Library will be installed to /usr/local/android/lib Public headers will be installed to /usr/local/android/include/Qca-qt5 Private headers will be installed to /usr/local/android/include/Qca-qt5 Feature file will be installed to /usr/local/android/mkspecs/features Documentation will be installed to /usr/local/android/share/doc/qca-qt5/html Man page will be installed to /usr/local/android/share/man Pkg-config file will be installed to /usr/local/android/lib/pkgconfig -- Configuring done -- Generating done
I have copied libraries into android/libs/armeabi-v7a/ linking and installing into Android device works fine, there are 3 plugins in crypto directory, visible in android-build directory:
libqca-gnupg.so libqca-logger.so libqca-softstore.so
But when app starts is does not support any of these plugins
QCA::Initializer init; if(QCA::isSupported("logger")) { qDebug()<<"BackEnd::encrypt logger supported"; } else { qDebug()<<"BackEnd::encrypt logger NOT supported"; } if(QCA::isSupported("softstore")) { qDebug()<<"BackEnd::encrypt softstore supported"; } else { qDebug()<<"BackEnd::encrypt softstore NOT supported"; } if(QCA::isSupported("openpgp")) { qDebug()<<"BackEnd::encrypt openpgp supported"; } else { qDebug()<<"BackEnd::encrypt openpgp NOT supported, return"; return; }
result is:
BackEnd::encrypt logger NOT supported BackEnd::encrypt softstore NOT supported BackEnd::encrypt openpgp NOT supported, return
Can someone give me some hint ? What is worying me is this sentence from QCA changes list
- qca-gnupg: try both gpg and gpg2 to find gnupg executable
if it is using command from OS then it will not work on Android ?
Best Regards
Marek
-
When I unzip APK file I can see that in lib/armeabi-v7a/ there is file libqca-qt5.so
file lib/armeabi-v7a/libqca-qt5.so lib/armeabi-v7a/libqca-qt5.so: ELF 32-bit LSB shared object, ARM, EABI5 version 1 (SYSV), dynamically linked, BuildID[sha1]=70b166ed2526bff0c5c8c365f2ef585ec73a6440, stripped
But there is no subdirectory "crypto" or any other that I have placed in android/libs/armeabi-v7a
How to tell QtCreator to include subdirectories from armeabi-v7a into APK ?Best Regards
Marek
-
Hi,
The Androïd deployment process is described here.
-
@SGaist thanks, somehow I can't make it work
There is some issue with gradle here
"fileTree() does not import the subdirectory"
https://github.com/gradle/gradle/issues/2394
So maybe it is not possible to include subdirectories ?Best
Marek
-
@Marek said in QCA on Android:
So maybe it is not possible to include subdirectories ?
That I do not know sorry.
It looks like it should be somehow possible. See this git gist.
-
@SGaist It looks like they are creating files instead of directories like this:
libplugins_crypto_libqca-ossl.so
So I created mine in the same manner
libplugins_crypto_libqca-gnupg.so
But QCA still says OpenPGP is not supported. Maybe it needs some underlying package like gnuPG to work. I have filed bug report to ask for this
https://bugs.kde.org/show_bug.cgi?id=432142Thanks for help
Marek