Page 1 of 1

Decrypting a Sqlcipher db with Zeos

Posted: 08.07.2024, 21:03
by Zein
I have to decrypt a db cripted with sqlcipher 4(i have the key), is it possible to do so with zeos?

Re: Decrypting a Sqlcipher db with Zeos

Posted: 09.07.2024, 21:56
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.