2016年10月19日 星期三

[Tools] Remove temp files from Eclipse

Eclipse:
Remove temp files


$PROJECT/.metadata/.plugins/org.eclipse.core.resources/.history/

2016年9月17日 星期六

PRIVACY POLICY

PRIVACY POLICY

We do not collect and save from your social account  in any form or sell any information to advertisers or other operators.

Personal information

When you share information through social accounts may be asked to enter the account and password, but that information is management by iOS or Android system. App does not save account and password in any form or collect and save any personal information in any form on your social account.

Privacy Policy Terms

Use this App mean you agree to the terms and conditions of this Privacy Policy. If you do not agree to this policy, please do not use this App. We reserve the right, in our decision to change, modify, add or remove portions of this policy at any time. Please check this page periodically for any changes. Publish any changes to these terms if you continue to use our App future will mean that you have accepted these adjustments.

2016年6月18日 星期六

[SQLITE] Compile SQLCipher in Android

Compile SQLCipher
Source: http://qiita.com/idaisuke/items/b4386705db7ec714f98a

My NDK version is r10d.


# export LIBRARY_PATH=/your/library/path

arm platform

# $NDK_ROOT/build/tools/make-standalone-toolchain.sh --arch=arm --install-dir=toolchain --platform=android-19

# HOST=arm-linux
# find toolchain/bin -name arm-linux-androideabi* -type f | while read FILE
do
  cp -f $FILE ${FILE%/*}/arm-linux${FILE##*-androideabi}
done
# cd src
# export PATH=$LIBRARY_PATH/SQLCipher/toolchain/bin:$PATH

armeabi

# ARCH=armv5
# PREFIX=$LIBRARY_PATH/SQLCipher/dest/armeabi
# OPENSSL_INCLUDE_PATH=$LIBRARY_PATH/OpenSSL/dest/armeabi/include
# OPENSSL_LIBRARY_PATH=$LIBRARY_PATH/OpenSSL/dest/armeabi/lib
# ./configure --prefix=$PREFIX -host=$HOST --enable-tempstore=yes --disable-tcl --disable-readline --with-pic CFLAGS="-DSQLITE_HAS_CODEC -DSQLITE_TEMP_STORE=2 -march=$ARCH -fPIE -I$OPENSSL_INCLUDE_PATH" LDFLAGS="-L$OPENSSL_LIBRARY_PATH"


# make clean && make && make install

armeabi-v7a

# ARCH=armv7-a
# PREFIX=$LIBRARY_PATH/SQLCipher/dest/armeabi-v7a
# OPENSSL_INCLUDE_PATH=$LIBRARY_PATH/OpenSSL/dest/armeabi-v7a/include
# OPENSSL_LIBRARY_PATH=$LIBRARY_PATH/OpenSSL/dest/armeabi-v7a/lib
# ./configure --prefix=$PREFIX -host=$HOST --enable-tempstore=yes --disable-tcl --disable-readline --with-pic CFLAGS="-DSQLITE_HAS_CODEC -DSQLITE_TEMP_STORE=2 -march=$ARCH -fPIE -I$OPENSSL_INCLUDE_PATH" LDFLAGS="-L$OPENSSL_LIBRARY_PATH"

# make clean && make && make install

x86 platform

# $NDK_ROOT/build/tools/make-standalone-toolchain.sh --arch=x86 --install-dir=toolchainx86 --platform=android-19

# HOST=i686-linux
# find toolchainx86/bin -name i686-linux-android* -type f | while read FILE
do
  cp -f $FILE ${FILE%/*}/i686-linux${FILE##*-android}
done
# cd src
# export PATH=$LIBRARY_PATH/SQLCipher/toolchainx86/bin:$PATH

x86

# ARCH=i386
# PREFIX=$LIBRARY_PATH/SQLCipher/dest/x86
# OPENSSL_INCLUDE_PATH=$LIBRARY_PATH/OpenSSL/dest/x86/include
# OPENSSL_LIBRARY_PATH=$LIBRARY_PATH/OpenSSL/dest/x86/lib

# ./configure --prefix=$PREFIX -host=$HOST --enable-tempstore=yes --disable-tcl --disable-readline CFLAGS="-DSQLITE_HAS_CODEC -DSQLITE_TEMP_STORE=2 -march=$ARCH -fPIE -fPIC -I$OPENSSL_INCLUDE_PATH" LDFLAGS="-L$OPENSSL_LIBRARY_PATH"

# make clean && make && make install


Add Android.mk

LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)

LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/$(TARGET_ARCH_ABI)/include/sqlcipher

LOCAL_MODULE := sqlcipher
LOCAL_SRC_FILES := $(TARGET_ARCH_ABI)/lib/libsqlcipher.a
include $(PREBUILT_STATIC_LIBRARY)

Modify Android.mk & Application.mk



Error fixed:


1. ErrMsg: ...external/curl/prebuilt/android/armeabi/libcurl.a(sha512-armv4.o): requires unsupported dynamic reloc R_ARM_REL32; recompile with -fPIC
http://discuss.cocos2d-x.org/t/android-cpp-test-compilation-error-solved/18348/3


[SQLITE] Compile OpenSSL in Android

Compile OpenSSL

!!Note!! Have to upgrade OpenSSL with version higher than 1.02f/1.01r, otherwise has security issue.
https://support.google.com/faqs/answer/6376725

My NDK version is r10d.

# export LIBRARY_PATH=/your/library/path

ARM platform

# $NDK_ROOT/build/tools/make-standalone-toolchain.sh --arch=arm --install-dir=toolchain --platform=android-19

armeabi

# cd src
# export ANDROID_DEV=$NDK_ROOT/platforms/android-19/arch-arm/usr
# CROSS_COMPILE_PREFIX=$LIBRARY_PATH/OpenSSL/toolchain/bin/arm-linux-androideabi-
# PREFIX=$LIBRARY_PATH/OpenSSL/dest/armeabi
# ./Configure --prefix=$PREFIX --cross-compile-prefix=$CROSS_COMPILE_PREFIX android threads no-shared
# make -s && make install

armeabi-v7a

# PREFIX=$LIBRARY_PATH/OpenSSL/dest/armeabi-v7a
# make clean
# ./Configure --prefix=$PREFIX --cross-compile-prefix=$CROSS_COMPILE_PREFIX android-armv7 threads no-shared
# make -s && make install

x86 platform

# $NDK_ROOT/build/tools/make-standalone-toolchain.sh --arch=x86 --install-dir=toolchainx86 --platform=android-19

x86

# make clean
# export ANDROID_DEV=$NDK_ROOT/platforms/android-19/arch-x86/usr
# CROSS_COMPILE_PREFIX=$LIBRARY_PATH/OpenSSL/toolchainx86/bin/i686-linux-android-
# PREFIX=$LIBRARY_PATH/OpenSSL/dest/x86
# cd src
# ./Configure --prefix=$PREFIX --cross-compile-prefix=$CROSS_COMPILE_PREFIX android threads no-shared
# make -s && make install

Android.mk

LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)

LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/$(TARGET_ARCH_ABI)/include/sqlcipher

LOCAL_MODULE := sqlcipher
LOCAL_SRC_FILES := $(TARGET_ARCH_ABI)/lib/libsqlcipher.a
include $(PREBUILT_STATIC_LIBRARY)

Modify Android.mk & Application.mk

[MMO] Cocos2D-x ~ MMO

AppWarp: Cocos2DX Multiplayer Game DevelopmentNinjaFight (tutorial)
planeshift
photon: VMware
KBEngine: Example

The Mana World
Worldforge

AnyNDK: EarthWarrior3D


2016年6月12日 星期日

[SQLITE] sqlite3 encryption/decryption

SQLite3 Simple works

sqlite3 commands.
http://www.runoob.com/sqlite/sqlite-syntax.html

SQLite Manager on Firefox. (Of course, it's free.)
https://addons.mozilla.org/zh-tw/firefox/addon/sqlite-manager/
https://dotblogs.com.tw/toysboy21/2014/04/21/144813

Android SQLite Database Tutorial.
http://www.tutorialspoint.com/android/android_sqlite_database.htm

SQLite for iOS.
http://pro.ctlok.com/2010/07/iphone-ipad-with-sqlite.html
https://www.facebook.com/teacherchi/posts/359338594127416

SQLite for Android.
https://github.com/sqlcipher/android-database-sqlcipher

CopyFiles.
http://www.iforce2d.net/cc2dxres/fileutils

SQLite Manager
http://www.sqlabs.com/sqlitemanager.php

SQLite3 Encryption/Decryption

Types of sqlite3 encryption/decryption

sqlcipher_export() to make plain text database to be encrypted.
https://www.zetetic.net/sqlcipher/sqlcipher-api/#sqlcipher_export

SQL Cipher is free but need some works.
Here is SQL Cipher official web site:

sqlcipher gits:

Make Sqlcipher available on iOS and Android.
To Make Sqlcipher available on iOS.

To Make Sqlcipher available on Android.

Reference web sites:
My Solution:
1. Use SQLiteManager to encrypt the database.


2. To decrypt the database in code.