Android(Kotlin)
Android ROOM sqlcipher
----___<<<<<
2022. 9. 20. 01:26
@Database(entities = [TextEntity::class], version = 1)
abstract class TextDatabase : RoomDatabase() {
abstract fun textDao() : TextDao
companion object {
@Volatile
private var INSTANCE : TextDatabase? = null
fun getDatabase(
context : Context
) : TextDatabase {
return INSTANCE ?:synchronized(this){
val instance = Room.databaseBuilder(
context.applicationContext,
TextDatabase::class.java,
"text_database_1"
)
.fallbackToDestructiveMigration()
.build()
// val factory = SupportFactory(SQLiteDatabase.getBytes("PassPhrase".toCharArray()))
//
// val instance = Room.databaseBuilder(
// context.applicationContext,
// TextDatabase::class.java,
// "text_database_2"
// )
// .openHelperFactory(factory)
// .fallbackToDestructiveMigration()
// .build()
INSTANCE = instance
instance
}
}
}
}
- 참조
https://github.com/sqlcipher/android-database-sqlcipher
GitHub - sqlcipher/android-database-sqlcipher: Android SQLite API based on SQLCipher
Android SQLite API based on SQLCipher. Contribute to sqlcipher/android-database-sqlcipher development by creating an account on GitHub.
github.com
https://sonique6784.medium.com/protect-your-room-database-with-sqlcipher-on-android-78e0681be687
Protect your Room database with SQLCipher on Android
Improve tremendously the protection of your users’ data, by implementing encrypted database with SQLCipher for Room
sonique6784.medium.com