I commonly use DB Browser for sqlite (https://sqlitebrowser.org/) for reading, writing and encrypting database. This is a simple and powerful tool available for Windows and MAC OS.

Creating an example (Flutter Application)

sqflite | Flutter Package

Testing how secure it is

Retrieving sensitive data from installed iOS application

Image for post

Using DB Browser for sqlite tool (https://sqlitebrowser.org/), you can see on the background of the picture that I’m able to read all the content, without any password prompt. Don’t be confused: even if database name is “encrypted.db”, its not encrypted yet.

Retrieving sensitive data from the iOS Application file

Image for post

Then open the package content.

Image for post

Image for post

Image for post

Encrypt your database using SQL Cipher technology

#  sqflite: ^1.3.2+1
  sqflite_sqlcipher: ^1.1.4
Future<Database> _initDatabase() async {
  if(_dbConf.isAsset) {
    await _copyAssetToLocal();
  }
  print("Database path: ${await getDatabasesPath()}");
  _database = await openDatabase(
    _dbConf.name,
    password: _dbConf.password,
    onCreate: DBService._onCreate,
    version: 1,
  );
  return _database;
}

Let’s see how secured it goes

Retrieve installed APK (the hard way)

Image for post

Image for post

I suggest you to have only one device found. Else each command will need you to specify the device.
Image for post

Image for post

Image for post

Image for post

Retrieve compiled apk (the easy way)

Image for post

Image for post

Retrieve embedded file from an apk

Image for post

Image for post

Image for post

Image for post

Image for post

Image for post

Image for post

Image for post

You shall to store output into a file to process data later 😉
Image for post

Image for post

In red, plain password. In green, database name.

Conclusion