SQLite
 sql >> Database >  >> RDS >> SQLite

Come implementare SQLCipher quando si utilizza SQLiteOpenHelper

In questa situazione come dovrei usare SQLCipher?

Esattamente come una normale implementazione di sql.

Dove devo definire la password?

Se stai usando SQLiteHelper, creerà il database quando lo ottieni per la prima volta in questo modo:

helper.getWriteableDatabase("myPassword");

Alla prima chiamata creerà il database con questa password. Sulle chiamate in arrivo funzionerà solo con questa password.

(L'ho capito quando sono andato alla fonte:https://github.com/sqlcipher/android-database-sqlcipher/blob/master/android-database-sqlcipher/src/main/java/net/sqlcipher/database/SQLiteOpenHelper .java, controlla il metodo getWriteableDatabase(String pw)lì!)

Dove dovrei usare loadLibs(context)?

Subito prima di chiamare helper.getWriteableDatabase("myPassword"); la prima volta!