Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@ed-george
Created June 4, 2022 00:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ed-george/703002be3904cbbe151d137f37c59383 to your computer and use it in GitHub Desktop.
Save ed-george/703002be3904cbbe151d137f37c59383 to your computer and use it in GitHub Desktop.
Unpacking Android Security: Part 2 - Insecure Data Storage (Example 4)
// Use a user-entered passphrase to encrypt/decrypt
val passPhrase: ByteArray = "password".encodeToByteArray()
val sqlCipherSupportFactory: SupportSQLiteOpenHelper.Factory = SupportFactory(passPhrase)
val database = Room.databaseBuilder(
applicationContext,
YourRoomDatabase::class.java,
"secure-database")
.openHelperFactory(sqlCipherSupportFactory)
.build()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment