SQLCipher for Android 3.3.1-2 Release

We have just released a patch release of SQLCipher for Android, version 3.3.1-2. This addresses an issue reported on Android OS 4.0.3 for the x86 platform. New binaries are available on Maven Central, synchronization should occur today if you are using JCenter. The latest AAR reference is:

compile 'net.zetetic:android-database-sqlcipher:3.3.1-2@aar'

Hi, we have this problem with a samsung tablet with Android 4.4.4 and importing net.zetetic:android-database-sqlcipher:3.3.1-2:

11-02 15:44:19.457: I/SurfaceFlinger(169): id=705
createSurf (800x2560),-1 flag=20004, ClackSurfac

  11-02 15:44:19.467: D/dalvikvm(18542): Trying to load lib
    /data/app-lib/com.leapfactor.renaware.phone.salesfactor-3/libstlport_shared.so
    0x41de0b98

  11-02 15:44:19.467: D/PhoneStatusBar(808):
    setSemiTransparentMode=false, mTransparentMode=false,
    mSemiTransparentMode=false, mMultiWindowMode=

  11-02 15:44:19.467: D/dalvikvm(18542): Added shared lib
    /data/app-lib/com.leapfactor.renaware.phone.salesfactor-3/libstlport_shared.so
    0x41de0b98

  11-02 15:44:19.467: D/dalvikvm(18542): No JNI_OnLoad
    found in
    /data/app-lib/com.leapfactor.renaware.phone.salesfactor-3/libstlport_shared.so
    0x41de0b98, skipping init

  11-02 15:44:19.467: D/dalvikvm(18542): Trying to load lib
    /data/app-lib/com.leapfactor.renaware.phone.salesfactor-3/libsqlcipher_android.so
    0x41de0b98

  11-02 15:44:19.467: D/dalvikvm(18542): Added shared lib
    /data/app-lib/com.leapfactor.renaware.phone.salesfactor-3/libsqlcipher_android.so
    0x41de0b98

  11-02 15:44:19.467: D/dalvikvm(18542): No JNI_OnLoad
    found in
    /data/app-lib/com.leapfactor.renaware.phone.salesfactor-3/libsqlcipher_android.so
    0x41de0b98, skipping init

  11-02 15:44:19.467: D/dalvikvm(18542): Trying to load lib
    /data/app-lib/com.leapfactor.renaware.phone.salesfactor-3/libdatabase_sqlcipher.so
    0x41de0b98

  11-02 15:44:19.467: D/StatusBarManagerService(583): semi
    p:18542,o:f

  11-02 15:44:19.477: D/dalvikvm(18542): Added shared lib
    /data/app-lib/com.leapfactor.renaware.phone.salesfactor-3/libdatabase_sqlcipher.so
    0x41de0b98

  11-02 15:44:19.477: I/Database(18542): JNI_OnLoad called

  11-02 15:44:19.477: I/Database(18542): JNI_OnLoad
    register methods 

  11-02 15:44:19.487: D/@@@MobileLibraryManagerImpl(18542):
    Version checked...

  11-02 15:44:19.487: I/SurfaceFlinger(169): id=700 Removed
    talesfactor (7/16)

  11-02 15:44:19.487: W/ApplicationPackageManager(18542):
    getCSCPackageItemText()

  11-02 15:44:19.487: I/SurfaceFlinger(169): id=700 Removed
    talesfactor (-2/16)

  11-02 15:44:19.497: A/libc(18542):
      Fatal signal 11 (SIGSEGV) at 0x6cb31f12 (code=1), thread 18558
      (startup)

  11-02 15:44:19.497: E/BaseFragmentActivity(18542):
    Activity - 
    com.leapfactor.stencil.lib.ui.activity.SplashActivity

  11-02 15:44:19.497: I/AndroidRuntime(18542): VM exiting
    with result code 0, cleanup skipped.

  11-02 15:44:19.497: W/ActivityManager(583): Permission
    Denial: getCurrentUser() from pid=18542, uid=10098 requires
    android.permission.INTERACT_ACROSS_USERS

  11-02 15:44:19.547: I/DEBUG(18540): unexpected waitpid
    response: n=18558, status=00000000

  11-02 15:44:19.547: I/DEBUG(18540): ptrace detach from
    18558 failed: No such process

  11-02 15:44:19.547: I/DEBUG(18540): debuggerd committing
    suicide to free the zombie!

  11-02 15:44:19.547: I/DEBUG(18561): debuggerd: Sep 10
    2015 00:02:20

  11-02 15:44:19.557:
      I/ActivityManager(583): Process
      com.leapfactor.renaware.phone.salesfactor (pid 18542) (adj 0)
      has died.(98,491)

in other devices just works fine. Any suggestion? Thanks

Hello @Javier_Comas

Are you able to recreate the issue with the SQLCipher for Android test suite?

Hi, where can i send you the test suite log file?

Hello @Javier_Comas

Were you able to reproduce the issue when running the test suite? Are you a commercial license holder, or are you using the community edition of the library?

Hi,

I have an existing Android App with encrypted DB (encrypted using SQL cipher 2.2.0)

Recently we updated the cipher lib to 3.3.1-2 ( compile ‘net.zetetic:android-database-sqlcipher:3.3.1-2@aar’)

App works fine on new installation. Problem occurs on devices where i am trying to use existing set up (i mean access existing Db)

Following is my code.

       SQLiteDatabaseHook hook=new SQLiteDatabaseHook() {

		public void preKey(    SQLiteDatabase database){				
			database.rawExecSQL("PRAGMA cipher_default_use_hmac=off;");
		}
		public void postKey(    SQLiteDatabase database){ }
	};
	try {
		SQLiteDatabase source=SQLiteDatabase.openOrCreateDatabase(databaseToMigrate,password,null,hook);} catch(Exception e) { }

 ********DB was created using this line *************
  db = SQLiteDatabase.openOrCreateDatabase(vDbPath, mdbEKey, null);

It gives following error:

11-17 14:02:24.067 2247-2247/org.bz.mws.Screens I/Database: sqlite returned: error code = 26, msg = file is encrypted or is not a database
11-17 14:02:24.067 2247-2247/org.bz.mws.Screens E/Database: CREATE TABLE android_metadata failed
11-17 14:02:24.069 2247-2247/org.bz.mws.Screens E/Database: Failed to setLocale() when constructing, closing the database
11-17 14:02:24.069 2247-2247/org.bz.mws.Screens E/Database: net.sqlcipher.database.SQLiteException: file is encrypted or is not a database: create locale table failed

I am stuck in this for quiete a few days. please help to resolve this. Tried out different options in PreKey but nothing helped.

Thanks in advance.

Hi @ManojBZ

Were you previously disabling the per page HMAC when you used SQLCipher 2.2.0? If not, you should not need the PRAGMA cipher_default_use_hmac=off; command. You will need to migrate the existing database files to the 3.x format, you can do this with the PRAGMA cipher_migrate; command.

Hi @developernotes,

Thanks!! My App is working now. But i have a bit concern. The App has considerably slowed down.

I am running App on Moto E2 with android version 5.0.2.

Prior to upgrade i.e. using sqlcipher 2.2, same App had nice speed on this very device.

Please suggest how can optimize the speed.

Hello @ManojBZ

With regard to the impact SQLCipher may have on your application, we have a post covering the details of performance here. Would you review that and see if it may apply to your application? Thanks!

A post was split to a new topic: Native runtime crash from SQLCipher for Android

your test suite working proper on my tablet but in my project when calling SQLiteDatabase.loadLibs(context); give error
java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file “/system/framework/com.google.android.maps.jar”, zip file “/data/app/com.atscene.icrimefighterle-1/base.apk”],nativeLibraryDirectories=[/data/app/com.atscene.icrimefighterle-1/lib/arm64, /vendor/lib64, /system/lib64]]] couldn’t find “libstlport_shared.so”