Yuvaraj
04/23/2024, 5:15 PMSystem.loadLibrary("sqlcipher");
String password = "Password1!";
File databaseFile = context.getDatabasePath("demo.db");
SupportOpenHelperFactory factory = new SupportOpenHelperFactory("password.getBytes(StandardCharsets.UTF_8));
db = Room.databaseBuilder(context, AppDatabase.class, databaseFile.getAbsolutePath())
.openHelperFactory(factory).build();
jw
04/23/2024, 5:17 PMjw
04/23/2024, 5:17 PMYuvaraj
04/23/2024, 5:25 PMoverride fun createDriver(): SqlDriver {
//System.loadLibrary("sqlcipher") initialize on app launch
val password = "Password1!"
val factory = SupportOpenHelperFactory(password.toByte())
return AndroidSqliteDriver(
databaseInfo.schema,
context,
databaseInfo.name,
factory
)
}
with this all the tables data in db will be encrypted automatically and on read data will be decrypted automatically? no extra work here?Yuvaraj
04/23/2024, 6:46 PM