Giter Site home page Giter Site logo

cryptimeleon / android-demo Goto Github PK

View Code? Open in Web Editor NEW
1.0 2.0 2.0 7.04 MB

An example project with instructions on how to use cryptimeleon on android.

Home Page: https://cryptimeleon.org/getting-started/pairing-tutorial.html

License: Apache License 2.0

Java 100.00%
android-app cryptography mcl pairing android

android-demo's Introduction

Build

Cryptimeleon on Android

This repository is an example of how to use the cryptimeleon libraries on android. We therefore implement the Pointcheval-Sanders signature scheme from the pairing tutorial.

How to use cryptimeleon on android

  1. Create a new android project in Android Studio.
  2. Add cryptimeleon dependencies to app/build.gradle:
    implementation 'org.cryptimeleon:math:3.+'
    implementation 'org.cryptimeleon:craco:3.+'
    
    You can find details on the maven pages: math, craco

Note: When running using a Virtual Device (Android Emulator), make sure to use a x86_64 image.

Faster pairings with mcl

We use the C++ library herumi/mcl as a fast implementation of the BarretoNaehrig group. This provides a massive speedup compared to the Java implementation.

Precompiled library

We provide a precompiled version of mcljava for different architectures at app/src/main/jniLibs. To use them, you need to load the library with the System.loadLibrary("mcljava") command. By adding the dependency implementation 'org.cryptimeleon:mclwrap:3.0.0' to the inner build.gradle, you get access to the MclBilinearGroup.

Compile MCL for android

This needs to be compiled using NDK and added to the project as a jniLib.

  1. Install NDK
  2. Checkout MCL with the correct version (currently v1.28, which is the first release with native android support)
  3. Build mcl (might not be necessary) by following the instructions
  4. Build mcl for android: Go to mcl/ffi/java/android/jni and call ndk-build (either add ndk-build to your path, or use an absolute path, e.g. $<path-to-mcl>/ffi/java/android/jni$ ~/Android/Sdk/ndk/22.1.7171670/ndk-build). Currently, mcl's Application.mk builds native libraries for the arm64-v8a, armeabi-v7a and x86_64 architectures. If you require additional architectures (e.g. x86 for the Android emulator), add a space and the architecture name at the and of the line starting with APP_ABI in Application.mk before invoking ndk-build
  5. Copy the directories in mcl/ffi/java/android/libs (which contain the libmcljava.so file) to app/src/main/jniLibs
  6. Load mcl in the app prior usage with System.loadLibrary("mcljava"), e.g. in MainActivity.onCreate.
  7. Add the dependency implementation 'org.cryptimeleon:mclwrap:3.0.0' to the app's build.gradle

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.