簡體   English   中英

如何在Flutter中加密SQLite數據庫?

[英]How to encrypt the SQLite database in Flutter?

我通過以下代碼在Flutter中創建數據庫,有什么方法可以加密數據庫?

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;
  }

目前,Pointy Castle似乎是首選的加密庫。

當前的sqflite使用平台提供的任何sqlite版本。 您可以在此處進行有關此問題的討論: https : //github.com/tekartik/sqflite/issues/32

我現在知道的唯一解決方案是這個https://github.com/QwilApp/encrypted_sqlite ,它可以用作sqflite的直接替代品,正如您所說的,sqlflite在本機端使用SQLCipher

我今天也在尋找這樣的圖書館。

最后,我在pub.dev中找到flutter_sqlcipher ,這確實解決了我的問題。

這是它的描述。

這是一個Flutter插件,捆綁並包裝了適用於Android的SQLCipher,這是SQLite的開源擴展,可提供數據庫文件的透明256位AES加密。

希望對您有幫助。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM