Recent

Author Topic: FPC/Lazarus supporting SQLite + SEE (SQLite Encryption Extension)  (Read 4938 times)

ArminLinder

  • Sr. Member
  • ****
  • Posts: 314
  • Keep it simple.
For my next project I need file level database encryption on Windows & Linux.

To start anywhere, I read the Wikis and found there is an extension to SQLite named SQLite Encryption Extension (SEE) providing this. Unfortunately there is quite sparse info in the Wiki (dated 2015) whether this extension is supported in FPC at all.

I'd like to get in contact with anyone using this feature to check beforehand whether it can be risky to try to use FPC/Lazarus for this project.

Thanks a lot, Armin.
Lazarus 3.3.2 on Windows 7,10,11, Debian 10.8 "Buster", macOS Catalina, macOS BigSur, VMWare Workstation 15, Raspberry Pi

MarkMLl

  • Hero Member
  • *****
  • Posts: 6686
Re: FPC/Lazarus supporting SQLite + SEE (SQLite Encryption Extension)
« Reply #1 on: December 09, 2021, 01:19:40 pm »
I suggest appending links to any documentation and libraries you've found.

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

ArminLinder

  • Sr. Member
  • ****
  • Posts: 314
  • Keep it simple.
Re: FPC/Lazarus supporting SQLite + SEE (SQLite Encryption Extension)
« Reply #2 on: December 09, 2021, 01:27:32 pm »
There are a few lines here ...

https://wiki.freepascal.org/SQLite#Support_for_SQLite_encryption

I tried to follow the links under "Support for SQL encryption" and ended up in sites where folks talk a lot about C++, .net and Java (JDBC) environments, but it remains unclear (to me) whether current, stable and documented interfaces exist for FPC under Windows and Linux.
« Last Edit: December 09, 2021, 01:32:13 pm by Nimral »
Lazarus 3.3.2 on Windows 7,10,11, Debian 10.8 "Buster", macOS Catalina, macOS BigSur, VMWare Workstation 15, Raspberry Pi

PascalDragon

  • Hero Member
  • *****
  • Posts: 5481
  • Compiler Developer
Re: FPC/Lazarus supporting SQLite + SEE (SQLite Encryption Extension)
« Reply #3 on: December 09, 2021, 02:00:15 pm »
I tried to follow the links under "Support for SQL encryption" and ended up in sites where folks talk a lot about C++, .net and Java (JDBC) environments, but it remains unclear (to me) whether current, stable and documented interfaces exist for FPC under Windows and Linux.

Please read again what is written there:

Quote
In recent FPC versions (implemented March 2012), SQLDB included support for some extended versions of SQLite3 which encrypt the SQLite database file using the AES algorithm. Use the password property to set the encryption key.

This means that since at least FPC 3.0.0 (which was released after 2012) the TSQLite3Connection supports SQLite3 libraries with encryption enabled by using the Password property (*).

For the links below that it's important to read the remarks next to the links to understand what the author is getting at:

Quote
Examples:

    SQLCipher: open source, e.g. Windows binaries not for free (you have to compile them yourself)
    System.Data.SQLite: open source, Windows (32, 64, CE) binaries available, download e.g one of the Precompiled Binaries and rename SQLite.Interop.dll to sqlite3.dll (if you're using the Statically Linked ones, presumably you need to rename System.Data.SQLite.DLL to sqlite3.dll)
    wxSQLite3: open source, some binaries for Linux available (ex: https://launchpad.net/ubuntu/oneiric/+package/libwxsqlite3-2.8-0)

The point this is trying to make is that you need a variant of the SQLite library that has encryption enabled which the default library does not have and these links provide potential sources for such libraries.

This can of course be phrased better, but that's what is meant by this. (And using a suitable SQLite library binary is necessary for any programming environment you may use)

(*) Though depending on what you use it might also be necessary to enable the encryption separately as written here at the point 5.0 C interface where you need to invoke sqlite3_activate_see() with your product key before accessing an encrypted database.

AlexTP

  • Hero Member
  • *****
  • Posts: 2402
    • UVviewsoft
Re: FPC/Lazarus supporting SQLite + SEE (SQLite Encryption Extension)
« Reply #4 on: December 09, 2021, 02:32:28 pm »
PascalDragon, I appended your last phrase to the wiki https://wiki.freepascal.org/SQLite#Support_for_SQLite_encryption

kjteng

  • Sr. Member
  • ****
  • Posts: 259
Re: FPC/Lazarus supporting SQLite + SEE (SQLite Encryption Extension)
« Reply #5 on: December 12, 2021, 12:02:11 pm »
I have been using wsSqlite + zeoslib for quite sometime.
For your reference, see https://forum.lazarus.freepascal.org/index.php/topic,57488.msg427625.html#msg427625

 

TinyPortal © 2005-2018