Hi ! First of all .. I very appreciate with your answer ! I don't expect answer .. but I saw your answer and I moved it.
I saw your other article about crypto++ and I learned a lot of things ! for example.. http://www.codeproject.com/script/Membership/View.aspx?mid=349853 CASE1 : Vmware + Ubuntu 14.0 + NDK 10r I saw this site. but it is very difficult for me. http://www.cryptopp.com/wiki/Android_%28Command_Line%29 So, I download source file and I unzip cryptopp-android-14.zip https://github.com/noloader/cryptopp-5.6.2-android-14 After unzip file (cryptopp-android-14.zip) i get libcryptopp.a file. 1) I create Android Application Project in Eclipse ( also I install CDT Plugin ) 2) I create jni folder and copy cryptopp header file (in cryptopp-android-14.zip include files) 3) I put libcryptopp.a file in libs/libcryptopp.a 4) I reference this site http://morgwai.pl/ndkTutorial/ and visit http://morgwai.pl/ndkTutorial/ 5) download NdkTutorial project and copy src folder, AndroidmManifest.xml, res folder (if you error file in res folder just remove!, and R file error appropreate change) 6) I create my module in jni folder named crypt_user.cpp extern "C" { JNIEXPORT jstring JNICALL Java_pl_morgwai_ndktutorial_Native_fun(JNIEnv *env, jobject) { string readSignater; string publicFileName = "publicKey"; string message = "RSA System Test"; try { AutoSeededRandomPool rng; InvertibleRSAFunction parameters; parameters.GenerateRandomWithKeySize(rng, 1024); RSA::PublicKey publicKey(parameters); .... } // try catch (CryptoPP::Exception& e) { std::cerr << "Error: " << e.what() << std::endl; } return (env)->NewStringUTF("Hello JNI!!!!!"); } } 7) Edit Android.mk file LOCAL_PATH := $(call my-dir) include $(CLEAR_VARS) LOCAL_MODULE := static_crypt # anything.. LOCAL_SRC_FILES := ../libs/libcryptopp.a # libs/libcryptopp.a (in cryptopp-android-14.zip include files) include $(PREBUILT_STATIC_LIBRARY) include $(CLEAR_VARS) LOCAL_MODULE := mymodule LOCAL_C_INCLUDES := \ $(LOCAL_PATH)/cryptopp \ FILE_LIST := \ $(wildcard $(LOCAL_PATH)/*.c*) \ LOCAL_SRC_FILES := $(FILE_LIST:$(LOCAL_PATH)/%=%) # Add .. LOCAL_CFLAGS := -Os LOCAL_CFLAGS += -ffunction-sections LOCAL_CFLAGS += -fdata-sections LOCAL_CFLAGS += -fvisibility=hidden LOCAL_CFLAGS += -Wl LOCAL_CFLAGS += --exclude-libs LOCAL_STATIC_LIBRARIES := static_crypt include $(BUILD_SHARED_LIBRARY) 8) Edit Application.mk APP_ABI := armeabi APP_STL := stlport_static APP_PLATFORM := android-8 APP_CFLAGS += -Wno-error=format-security APP_CFLAGS += -fexceptions \ -fpermissive \ -frtti 9) build command ndk-build move project position ex) /workspace/Staticbuild/jni and ndk-build $ ndk-build [armeabi] SharedLibrary : libmymodule.so [armeabi] Install : libmymodule.so 10) After build the module size 5KB !! 11) For test, I Edit package pl.morgwai.ndktutorial; public class Native { public static final String LOG_TAG = Native.class.getSimpleName(); static { System.loadLibrary("mymodule"); } public native String fun(); } CASE2 : window + NDK 10r I download Crypto++ 5.6.2 and build in eclipse with window enviroment ( setting : install cygwin for window & install eclipse CDT plugin ) Environment - Eclipse with CDT - window - cygwin - NDK, SDK (android) First, I build raw crypto++ source code static library. 1) Create Android Application Project in Eclipse 2) Create JNI Folder and copy Crypto++ source code all (Specific position) 3) In Eclipse project, click right click . new -> convert c++ project ( select static library option) 4) create Android.mk file and Application.mk file < Application.mk > APP_ABI := armeabi APP_STL := stlport_static APP_CFLAGS += -Wno-error=format-security APP_CFLAGS += -fexceptions \ -fpermissive < Android.mk > # sattic library build file include $(CLEAR_VARS) # module name ramdom .. (you want) LOCAL_MODULE := random name # put crptopp all file (jni/cryptopp) FILE_LIST := $(wildcard $(LOCAL_PATH)/cryptopp/*.c*) LOCAL_SRC_FILES := $(FILE_LIST:$(LOCAL_PATH)/%=%) include $(BUILD_STATIC_LIBRARY) # dummy so file include $(CLEAR_VARS) LOCAL_MODULE := garbage LOCAL_STATIC_LIBRARIES := random name include $(BUILD_SHARED_LIBRARY) 5) Chaing eclipse project setting properties -C/C++ build : builder Settings - build command : ndk-build.cmd -C/C++ General : Path and symbols - Include Setting position toolchain.. (similar : http://202psj.tistory.com/465) 6) build and get libcrypto.a ( project - obj - local - armeabi - XXX.a) Second, I create another project 1) Create Android Application Project in Eclipse 2) Create Jni Folder and copyt crypto++ header file 3) And write my code under jni folder ( reference crypto++ api ) + put libcrypto.a file 4) Edit Android.mk, Application.mk and build so library LOCAL_PATH := $(call my-dir) include $(CLEAR_VARS) LOCAL_MODULE := cryptopplibrary # static build library position LOCAL_SRC_FILES := ../libs/libcrpytopp.a include $(PREBUILT_STATIC_LIBRARY) include $(CLEAR_VARS) LOCAL_LDLIBS := -llog -lz LOCAL_MODULE := temp LOCAL_CFLAGS := -Os LOCAL_CFLAGS += -ffunction-sections LOCAL_CFLAGS += -fdata-sections LOCAL_CFLAGS += -fvisibility=hidden LOCAL_CFLAGS += -Wl LOCAL_CFLAGS += --exclude-libs LOCAL_C_INCLUDES := \ $(LOCAL_PATH) \ $(LOCAL_PATH)/cryptopp \ FILE_LIST := \ $(wildcard $(LOCAL_PATH)/*.c*) \ LOCAL_SRC_FILES := $(FILE_LIST:$(LOCAL_PATH)/%=%) LOCAL_STATIC_LIBRARIES := cryptopplibrary include $(BUILD_SHARED_LIBRARY) 4) After build , I create my crypto library (only i want function ) The size is down!! -- -- You received this message because you are subscribed to the "Crypto++ Users" Google Group. To unsubscribe, send an email to [email protected]. More information about Crypto++ and this group is available at http://www.cryptopp.com. --- You received this message because you are subscribed to the Google Groups "Crypto++ Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
