Search code examples
delphisqlitezeos

ZeosDb : Encrypt SQLite


I am using ZeosDB component to access sqlite database. It works fine on an unencrypted db.

On a encrypted db i receive : file is encrypted or not a database. Eaven if I set the password.

Is the DLL file I use wrong ? I use the last dll from the official page.It does not support encryption by default ?


Solution

  • There are several encryption schemes on SQLite3.

    Among them, you have:

    • The official not free encryption library from SQLite3 authors, named SQLite Encryption Extension (SEE): just pay and use the dll, and modify the initialization to set the database key;
    • Open Source SQLCipher;
    • WXSQlite3 wrapper;
    • For Delphi, our Open Source static-linked version included in our mORMot (with a custom encryption) - static linking allow you not to use an external sqlite3.dll so it will help making your deployment and support easier - it features easy switch to MS SQL, Oracle or OleDB/ODBC with the same source code from Delphi 5 up to XE3 and has great speed;
    • See the link above.

    ZeosDB SQLite3 level handle none of them.

    The SQlite3 API driver (unit ZPlainSqLiteDriver) does not contain the cyphering. So you will have to change it. Or switch to another wrapper which support encryption APIs.