This is an unofficial test app for https://github.com/open-quantum-safe/liboqs .
This app shows how to use liboqs on android devices. Usually you would use the openssl implementation but for end to end encryption using it locally may be useful.
The project is split into
-
the module which wraps the JNI Interface to use liboqs on android (https://github.com/Hatzen/LibOQSTestApp/tree/master/liboqs-android).
The package name "com.example.liboqs.*" will change in future and may produce a breaking change. -
and an example app (https://github.com/Hatzen/LibOQSTestApp/tree/master/app) showing the usage with a fictional example
Currently constant copies of https://github.com/open-quantum-safe/liboqs and https://github.com/open-quantum-safe/liboqs-java are used as android needs further configurations to build them for the correct abi.
The prebuild liboqs.so files (https://github.com/Hatzen/LibOQSTestApp/tree/master/app/jni/jniLibs) are generated with https://github.com/open-quantum-safe/liboqs/blob/main/scripts/build-android.sh manually.
There seems to be an issue (or further configuration) with compiling for 32 Bit abis like x86 and arm-7 (#2 and #3). Because of this the local emulator (x86) might not compile as no .so file is provided.
The jni files (https://github.com/Hatzen/LibOQSTestApp/tree/master/app/jni/jni) are slightly modified (package name changes and a minor fix) to compile successfully.
And the way of loading the liboqs.so files had to be changed: https://github.com/Hatzen/LibOQSTestApp/blob/master/liboqs-android/src/main/java/com/example/liboqs/Common.java#L31
in some cases it might be a better solution to use the openssl implementation.
But using it globally for all applications will require rooting the device and specific configurations.
Using it only for your own android application will require further investigation, but is possible:
https://stackoverflow.com/questions/3046573/how-to-use-openssl-library-in-the-android-application
https://proandroiddev.com/tutorial-compile-openssl-to-1-1-1-for-android-application-87137968fee
https://stackoverflow.com/a/54053709/8524651
https://wiki.openssl.org/index.php/Android
- Setup CI to use newest versions of jni and liboqs