Decrypting a Sqlcipher db with Zeos

Forum related to SQLite

Moderators: gto, cipto_kh, EgonHugeist

Post Reply
Zein
Fresh Boarder
Fresh Boarder
Posts: 1
Joined: 08.07.2024, 21:01

Decrypting a Sqlcipher db with Zeos

Post by Zein »

I have to decrypt a db cripted with sqlcipher 4(i have the key), is it possible to do so with zeos?
User avatar
aehimself
Zeos Dev Team
Zeos Dev Team
Posts: 786
Joined: 18.11.2018, 17:37
Location: Hungary

Re: Decrypting a Sqlcipher db with Zeos

Post by aehimself »

A previous post says that Zeos does not YET support sqlcipher with sqlite. As it's a commercial product, support in the open source community will be low as we don't like to pay for stuff :)

Now, I did my research back then which I already forgot but in said post I mentioned that the unlock should be a PRAGMA command.
What I'd do if I were in your shoes; is to introduce a new TZConnection property for SQLite protocol in ZPropertiesEditor.pas.

Almost all PRAGMA commands are executed in ZDbcSqLite.pas, procedure TZSQLiteConnection.Open; to be precise. If that new property which you added is set, execute the correct PRAGMA command to unlock the DB here; my guess is BEFORE calling inherited Open;. This is just a guess though, you'll have to experiment.

As for adding and handling these new properties, search for "ConnProps_journal_mode" in Zeos's sources. It's a connection property for SQLite only, so you can implement yours in a similar manner.
Delphi 12.1, Zeos 8 from latest GIT snapshot
Using:
- MySQL server 8.0.18; libmariadb.dll 3.3.8
- Oracle server 11.2.0, 12.1.0, 19.0.0; oci.dll 21.13
- MSSQL 2012, 2019; sybdb.dll FreeTDS_2435
- SQLite 3.45.2
Post Reply