0

Cipher Encryption is working fine but Database files contains no data when downloaded from Android Studio and open with DB browser for SQLite after implementing SQL Cipher in Room Database

val passphrase: ByteArray = net.sqlcipher.database.SQLiteDatabase.getBytes(
                AppConstants.DB_KEY.toCharArray()
            )
            val factory = SupportFactory(passphrase)
            val instance = Room.databaseBuilder(
                context.applicationContext,
                NeDatabase::class.java,
                DATABASE_NAME
            )
                .openHelperFactory(factory)
                .fallbackToDestructiveMigration()
                .allowMainThreadQueries()
                .addMigrations(MIGRATION_5_6, MIGRATION_6_7)
                .addCallback(DbApplicationCallback())
                .build()

Need To get Database tables and datas after implementing Cipher

vaibhavsahu
  • 612
  • 2
  • 7
  • 19
  • 1) Have you read https://github.com/sqlitebrowser/sqlitebrowser/wiki/Encrypted-Databases and perhaps importantly ***Providing you have a SQLCipher version of DB Browser for SQLite you simply need to select "Set Encryption" from the "Tools" menu and enter your chosen password.***. 2) are you downloading all the files, noting that by default Room uses **WAL** which applies changes to the -wal file. In short if the -wal file is not empty then part of the database is in the -wal file. the -wal file is the same name as the database file name suffixed with -wal. Best to also copy -shm file. – MikeT Aug 01 '23 at 06:10
  • thanks for replying .I'm already using DB Browser for SQLite(Cipher) . I copied all 3 files (database,database-shm,database-wal) . the browser asks for key and encryption works fine. But there is no datas or tables inside the DB . If i remove openHelpfactory(factory) it works fine – RAGHUL R Aug 01 '23 at 06:51

0 Answers0