views:

413

answers:

1

I can open a regular sqlite database on iPhone with

sqlite3_open([filename UTF8String], &database);

But how do I open a password encrypted database?

+2  A: 

Sqlite3 does not have builtin support for encryption. There is an extensions (CEROD) that support encryption, but the code is not publicly available, you need to license it. Apple has not, so the included version of sqlite3 does not support CEROD encrypted databases, if you have one you need to pay the licensing fee yourself, build a private copy of sqlite3 that included CEROD and use that.

If you are using CEROD and have built a custom sqlite3 supporting it then you would open the database like thing:

sqlite3_open(":cerod:%s:%s", [password UTF8String], [filename UTF8String], &database);

If you are not talking about CEROD then I have no idea what to tell you since, since any other encryption extensions are completely proprietary.

Louis Gerbarg
Ok, thanks. I created the database with "Mike T's SQLite Database Administrator Tool" (http://saxmike.com), and it has an option for encryption password. Wasn't aware that this is not a standard sqlite feature. I guess I'll have to find another solution for scrambeling my data.
rlovtang