Crypto++ in Android(Java project)

This is Android side.

We can get Next is to use this library from Android side.

We need special settings to use

Add to build C++ env is appliction makefile common settings.
The contents is

APP_ABI := armeabi
APP_CPPFLAGS += -fexceptions -frtti
#APP_STL := stlport_shared
APP_STL := gnustl_shared

These are common settings for C++ build


Android Cryptopp

Prepared 2 directories under jni.

Top level is following

include $(call all-subdir-makefiles)

Only calling sub directory

cryptocpp is crytocpp core library and headers.
I put under it. is following.

LOCAL_PATH:= $(call my-dir)

include $(CLEAR_VARS)

LOCAL_MODULE := cryptopp


This wraps build.
All shared libraries move under armeabi including STL.
crypt_user has codes of this project, it is JNI codes.

This is header example

#include <jni.h>
#include <cryptlib.h>

#include <iostream>
#include <iomanip>

using namespace std;

#ifndef _Included_Crypt_User
#define _Included_Crypt_User

#ifdef __cplusplus
extern "C" {
// JNI method description
#ifdef __cplusplus

In JNI, we need define method in extern C in Android.


std:string part doesn’t work. So I gave up std:string codes.
Instead I use byte array and jbyteArray in Android
char * is also fine I thought.