Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to encrypt the SQLite database in Flutter?

I am creating a database in Flutter by the following code, is there any way we can encrypt the database?

Is there any library available for Flutter?

initDb() async {
    io.Directory documentsDirectory = await getApplicationDocumentsDirectory();
    String path = join(documentsDirectory.path, "test.db");
    var theDb = await openDatabase(path, version: 1, onCreate: _onCreate);
    return theDb;
  }
like image 961
Raja Jawahar Avatar asked May 08 '18 11:05

Raja Jawahar


People also ask

Can you encrypt a SQLite database?

SQLite doesn't support encrypting database files by default. Instead, you need to use a modified version of SQLite like SEE, SQLCipher, SQLiteCrypt, or wxSQLite3.

Is SQFlite secure?

1. SQLite Always Validates Its Inputs. SQLite should never crash, overflow a buffer, leak memory, or exhibit any other harmful behavior, even when presented with maliciously malformed SQL inputs or database files. SQLite should always detect erroneous inputs and raise an error, not crash or corrupt memory.

Can we use SQLite in flutter?

Flutter apps can make use of the SQLite databases via the sqflite plugin available on pub.


1 Answers

Pointy Castle seems to be the encryption library of choice at the moment.

like image 174
Randal Schwartz Avatar answered Sep 30 '22 13:09

Randal Schwartz