JNI bindings to libsodium for Android (Studio) projects, based on Kalium-JNI
Java Shell Makefile
Latest commit ad4d0f8 May 9, 2016 @ArteMisc env

README.md

libstodium

Though the API is reaching a stable point, there may still be breaking changes between commits.

The goal of this library is to provide complete bindings of libsodium using JNI for the Android platform. It also provides implementations that try to handle the passing of data between the JVM and native code in a more efficient way, by supporting Java's method(array, offset, length) style for native methods.

Credits to:

Target platform

The library is heavily focussed on intergration with Android Studio and working on Android systems.

The supported Android API versions are:

  • Min SDK Version: 16 (4.1 Jelly Bean)
  • Target SDK Version: 23 (6.0 Marshmallow)

How to install

When you plan to use libstodium in an Android Studio project, I would recommend cloning the repository into a subdirectory of the project root.

  1. To start, download this repository (there is no need to download libsodium, the setup script handles this):

    $ git clone https://github.com/ArteMisc/libstodium.git
  2. (Optional) on Ubuntu, you can run this command to make sure everything is setup on your machine:

    $ ./install_system_dependencies.sh
  3. Next, run the setup script:

    $ ./setup.sh # load Ndk and Swig, install libsodium and JNI bindings, cleanup

In order for setup to run correctly, the environment variable JAVA_HOME should be set. If this is not the case, the script will quit. You can set the JAVA_HOME value using export JAVA_HOME=/path/to/java or by running the command like this:

$ JAVA_HOME=/path/to/java ./setup.sh

Notes:

  • Do NOT run the script as root. You will be asked to allow sudo for a few specific commands during the script's execution.
  • Currently supported architectures are:
    • mips
    • arm
    • arm-v7a
    • x86

License

Each part has its own software license, including:

TODO

  • Improve the API, provide more docs.
  • Make the API compatible with Java's native Security interfaces.
  • Add tests.
  • Support more architectures as they come along (mainly 64-bits archs).
  • Add code examples to the Readme.
  • Add a guide for adding the project as Android Studio module to a project.
  • Add support for Maven.