Data encryption (is it possible)

897 views
Skip to first unread message

igor.paunov

unread,
Dec 22, 2011, 4:30:17 PM12/22/11
to ORMLite Users
Is it possible to have encrypted database content stored on device sd
card?
I found some solutions for SQLite: http://sqlcipher.net/sqlcipher-for-android/

But I would like to use ORMLite! Very handy for me btw. Is it possible
to use ORMLite in combination to sqlcipher?
Are there other solutions for ORMLite ?

Thank you in advance
Kind regards
Igor Paunov

jc

unread,
Dec 24, 2011, 8:35:45 PM12/24/11
to ORMLite Users
OrmLite currently does not provide any encryption.

Oddly, I chatted with Gray on this topic a few days ago and he added
some items to the TODO list which you can find here:
http://ormlite.svn.sourceforge.net/viewvc/ormlite/ormlite-core/trunk/TODO.txt?view=markup

Also, after reading https://guardianproject.info/code/sqlcipher/ I
suspect OrmLite may not work initially and will probably require some
changes to use the correct package imports for sqlcipher. I plan to
look into this as well.

igor.paunov

unread,
Dec 29, 2011, 4:13:49 AM12/29/11
to ormlit...@googlegroups.com
Hello jc,
Thank you for your effort.  I checked TODO.txt

My opinion - it is better to support some transparent encryption like sqlcipher than to implement on OrmLite level.
Implementing on OrmLite level will cause issues with native queries, like you mentioned on TODO.txt

I am looking forward for next steps.

Thank you again.

Chris Nevill

unread,
Apr 3, 2012, 7:10:34 AM4/3/12
to ormlit...@googlegroups.com

On Thursday, December 22, 2011 9:30:17 PM UTC, igor.paunov wrote:
Is it possible to have encrypted database content stored on device sd
card?
I found some solutions for SQLite: http://sqlcipher.net/sqlcipher-for-android/

Would just like to add my voice for this one.
Thanks,
Chris

Alexey Nikitin

unread,
Apr 4, 2012, 3:43:22 AM4/4/12
to ormlit...@googlegroups.com
You may to it by yourself. Just replace in OrmLite sources for android android.database.* with info.guardianproject.database.* and add password for db.

пятница, 23 декабря 2011 г. 1:30:17 UTC+4 пользователь igor.paunov написал:

Mark Andrachek, Jr.

unread,
May 8, 2012, 12:44:49 PM5/8/12
to ormlit...@googlegroups.com
Android's a different beast, but for what it's worth, I'm currently using sqlcipher on Linux, with a slightly modified build of the sqlite jdbc driver from Xerial (just changed a few flags).

I'm using tomcat, so in order to pass the PRAGMA at the start of each connection, I've just extended the org.apache.tomcat.jdbc.pool.DataSourceFactory.  I've got the key, highly obfuscated, where the datasource factory can get at it, and I override the PROP_INITSQL property in the object with the necessary PRAGMA statement.

Sravani Ch

unread,
Feb 27, 2013, 4:16:48 AM2/27/13
to ormlit...@googlegroups.com
Hi All,
I am using ormlite and sqlite togethe in my Application. so there is no problem with inserting the data. while fetching the the data. i am getting this log. 

02-27 14:27:58.873: E/AndroidRuntime(7605): java.lang.NoSuchMethodError: net.sqlcipher.database.SQLiteDatabase.rawQuery
02-27 14:27:58.873: E/AndroidRuntime(7605): at com.j256.ormlite.android.AndroidCompiledStatement.getCursor(AndroidCompiledStatement.java:162)
02-27 14:27:58.873: E/AndroidRuntime(7605): at com.j256.ormlite.android.AndroidCompiledStatement.runQuery(AndroidCompiledStatement.java:57)
02-27 14:27:58.873: E/AndroidRuntime(7605): at com.j256.ormlite.stmt.SelectIterator.<init>(SelectIterator.java:55)
02-27 14:27:58.873: E/AndroidRuntime(7605): at com.j256.ormlite.stmt.StatementExecutor.buildIterator(StatementExecutor.java:232)
02-27 14:27:58.873: E/AndroidRuntime(7605): at com.j256.ormlite.stmt.StatementExecutor.query(StatementExecutor.java:181)
02-27 14:27:58.873: E/AndroidRuntime(7605): at com.j256.ormlite.dao.BaseDaoImpl.query(BaseDaoImpl.java:263)
02-27 14:27:58.873: E/AndroidRuntime(7605): at com.example.ormlitedbencryption.BookManager.getBookWithName(BookManager.java:72)
02-27 14:27:58.873: E/AndroidRuntime(7605): at com.example.ormlitedbencryption.MainActivity.onCreate(MainActivity.java:20)
02-27 14:27:58.873: E/AndroidRuntime(7605): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
02-27 14:27:58.873: E/AndroidRuntime(7605): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
02-27 14:27:58.873: E/AndroidRuntime(7605): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
02-27 14:27:58.873: E/AndroidRuntime(7605): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
02-27 14:27:58.873: E/AndroidRuntime(7605): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
02-27 14:27:58.873: E/AndroidRuntime(7605): at android.os.Handler.dispatchMessage(Handler.java:99)
02-27 14:27:58.873: E/AndroidRuntime(7605): at android.os.Looper.loop(Looper.java:123)
02-27 14:27:58.873: E/AndroidRuntime(7605): at android.app.ActivityThread.main(ActivityThread.java:4627)
02-27 14:27:58.873: E/AndroidRuntime(7605): at java.lang.reflect.Method.invokeNative(Native Method)
02-27 14:27:58.873: E/AndroidRuntime(7605): at java.lang.reflect.Method.invoke(Method.java:521)
02-27 14:27:58.873: E/AndroidRuntime(7605): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
02-27 14:27:58.873: E/AndroidRuntime(7605): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
02-27 14:27:58.873: E/AndroidRuntime(7605): at dalvik.system.NativeStart.main(Native Method)
i have imported all the libs and net.sqlcipher and net.sqlcipher.database packges but still getting this exception. please let me know if u have any suggestions

Jayakrishnan Salim

unread,
Aug 21, 2014, 9:18:00 AM8/21/14
to ormlit...@googlegroups.com, alek...@gmail.com
I have some issues in integrating ORM lite and SQL cipher. I am attaching the integrated file. Can anyone please help me?
LocalOrmLiteSqliteOpenHelper.java
Reply all
Reply to author
Forward
0 new messages