Encrypt/decrypt database with wsSQlite /Lazarus

In this forum you may discuss all issues concerning the Lazarus IDE and Freepascal (both running on Windows or Linux).

Moderators: gto, cipto_kh, EgonHugeist

kjteng
Senior Boarder
Senior Boarder
Posts: 54
Joined: 10.05.2015, 15:02

Re: Encrypt/decrypt database with wsSQlite /Lazarus

Post by kjteng »

marsupilami wrote: 13.12.2021, 11:50
Nice :) Unfortunately I don't have a license for SEE. So all we can do for now is to hope that we get everything right.

Some questions though:
- Is this change part of your file on github?
- Any chance for you to clone Zeos on Github and make the changes there? ;)

Best regards,

Jan
- Yes. I have uploaded my latest file to github
- I have cloned it but not sure whether I have done it corrrectly. Can I upload it to https://github.com/marsupilami79/zeosli ... er/src/dbc ?
User avatar
aehimself
Zeos Dev Team
Zeos Dev Team
Posts: 798
Joined: 18.11.2018, 17:37
Location: Hungary

Re: Encrypt/decrypt database with wsSQlite /Lazarus

Post by aehimself »

No, you can not. What you can do is:
- Clone the WHOLE Zeos repository to your own GitHub profile (this is called forking)
- Clone your own clone of Zeos repository in your own GitHub profile to your local PC
- Make any modifications on your PC
- Once all done and accounted for, push the changes back to GitHub (which will go to your own clone of Zeos on your GitHub)
- Open a pull request against Jan's Github repo. This way he can extract the diffs only and apply it to SVN.
Delphi 12.2, Zeos 8 from latest GIT snapshot
Using:
- MySQL server 8.0.18; libmysql.dll 8.0.40 x64 5.7.19 x68, libmariadb.dll 3.3.11
- Oracle server 11.2.0, 12.1.0, 19.0.0; oci.dll 21.15
- MSSQL 2012, 2019; sybdb.dll FreeTDS_3102
- SQLite 3.47
User avatar
aehimself
Zeos Dev Team
Zeos Dev Team
Posts: 798
Joined: 18.11.2018, 17:37
Location: Hungary

Re: Encrypt/decrypt database with wsSQlite /Lazarus

Post by aehimself »

kjteng wrote: 19.10.2021, 16:26It works !
Out of curiosity, does it work if you put this code in BeforeConnect / AfterConnect event handler?
That way encryption would be supported without having to change the code.

@Jan,
I seem to recall a discussion when you mentioned that pragma's aren't supported before we establish the connection - isn't that what happens here?
If yes, maybe we could make a new event handler called InitializeEncryption or similar which could be used for sending such commands the right place and time if needed.
Delphi 12.2, Zeos 8 from latest GIT snapshot
Using:
- MySQL server 8.0.18; libmysql.dll 8.0.40 x64 5.7.19 x68, libmariadb.dll 3.3.11
- Oracle server 11.2.0, 12.1.0, 19.0.0; oci.dll 21.15
- MSSQL 2012, 2019; sybdb.dll FreeTDS_3102
- SQLite 3.47
kjteng
Senior Boarder
Senior Boarder
Posts: 54
Joined: 10.05.2015, 15:02

Re: Encrypt/decrypt database with wsSQlite /Lazarus

Post by kjteng »

Hi aehimself:
Thanks for the pointer on the github procedures.
The pragma codes will not works if it is put in before connect or after connect. By trial and error, I found that wxSqlite decryption works only if the pragma statements are called after 'FPlainDriver.sqlite3_open(....)' but before the 'inherited open' (in procedure TZSQLiteConnection.Open;).
Regards
kjteng
Senior Boarder
Senior Boarder
Posts: 54
Joined: 10.05.2015, 15:02

Re: Encrypt/decrypt database with wsSQlite /Lazarus

Post by kjteng »

I have updated and tested my amendment for the latest version of zeoslib (Merged revision(s) 7863 from branches/8.0-patches).
The modified file (ZDbcSqLite.pas) is available at :- https://github.com/kjteng/zeoslib/tree/main/ZDbcSqLite
The older version has been renamed to ZDbcSqLite2.pas
Post Reply