#1 Today 04:00:46

Sapiem
Member
Registered: 2017-12-08
Posts: 65

Help with SQLite3 static encryption

Please, could someone provide me with a hint, reading or example of how to implement encryption in sqlite3 database with static access? In mormot1 it worked perfectly with the .o and .obj I had. But not now. Thanks

Offline

#2 Today 07:25:46

zen010101
Member
Registered: 2024-06-15
Posts: 159

Re: Help with SQLite3 static encryption

In mORMot 2, SQLite3 encryption is built into the static library. Here's how to use it:

  1. Download static files from https://synopse.info/files/mormot2static.7z
  2. Add mormot.db.raw.sqlite3.static to your uses clause
  3. Pass password when creating the database:

  uses
    mormot.db.raw.sqlite3.static,
    mormot.orm.sqlite3;

  var
    Model: TOrmModel;
    Rest: TRestServerDB;
  begin
    Model := TOrmModel.Create([...]);
    Rest := TRestServerDB.Create(Model, 'mydata.db3', False, 'MyPassword');

  Or with TSqlDatabase directly:
  DB := TSqlDatabase.Create('mydata.db3', 'MyPassword');

  Important notes:
  - This encryption is NOT compatible with official SQLite SEE or wxsqlite3
  - NOT compatible with old mORMot 1 format (before 1.18.4413) - use OldSqlEncryptTablePassWordToPlain() to migrate
  - Uses AES-128 with PBKDF2 key derivation

Offline

Board footer

Powered by FluxBB