Recent

Author Topic: LAMW: Encrypt sqlite DB  (Read 1280 times)

c4p

  • Full Member
  • ***
  • Posts: 164
LAMW: Encrypt sqlite DB
« on: August 08, 2024, 12:26:43 am »
Is there a way to encrypt the jSqliteDataAccess database using LAMW?

Thanks in advance.
Lazarus 2.0.12 r64642/FPC 3.2.0 LAMW v0.8.6.4 on Windows 10+Linux Mint 21.2, projects mainly built using AppCompat and Gradle.

Guser979

  • Jr. Member
  • **
  • Posts: 64
Re: LAMW: Encrypt sqlite DB
« Reply #1 on: August 08, 2024, 03:08:44 am »
Not at the moment. But you can ask chatgpt and he will guide you:

"I have a code that uses SQLiteDatabase from Android SDK, but I want to adapt this code and include encryption in my database. Give me an example"

PS. you wrote:

"Don't use jPanel in your LAMW app..."

Are you sure the problem is jpanel? Is your LAMW up to date?

I just migrated a project to use RecyclerView, Jlist, ScroolView and also used several Jpanel(respecting limits). Everything worked perfectly. Maybe it's some other detail causing the errors.
« Last Edit: August 08, 2024, 03:11:00 am by Guser979 »

c4p

  • Full Member
  • ***
  • Posts: 164
Re: LAMW: Encrypt sqlite DB
« Reply #2 on: August 08, 2024, 09:02:19 am »
Thanks, I have implemented dcpcrypt for an update file, but need the db encrypted now, I can try something with dcpcrypt I guess.

Not had much luck with chatgpt et al. most of the time it's wrong and you have to keep challenging it, had more luck on stackoverflow tbh.

Re jPanel, pretty sure, I've eliminated jPanel completely from my app now due to the sluggish performance I experienced, I even rebuilt the app from scratch at one point before realising, my LAMW is up to date, jPanel slows down the app considerably, although I need to do further testing what the tipping point is, but the performance hit disappeared when I got rid of jPanel in my app, a night and day performance difference, but, you might get away with one or two, but I got rid of them all, has caused me a headache for a while, rotate took a long time as did general speed of the app, I think it may be redraw issue, not really sure why though, I just avoid using it now.
I'm not having a go at the developers re jPanel btw, everyone involved in LAMW have done a tremendous job with LAMW, something I use every day now!
I think someone else needs to test jPanel to see what's going on as it really does impact the performance.
« Last Edit: August 08, 2024, 09:16:55 am by c4p »
Lazarus 2.0.12 r64642/FPC 3.2.0 LAMW v0.8.6.4 on Windows 10+Linux Mint 21.2, projects mainly built using AppCompat and Gradle.

Zvoni

  • Hero Member
  • *****
  • Posts: 2693
Re: LAMW: Encrypt sqlite DB
« Reply #3 on: August 08, 2024, 09:41:32 am »
Thanks, I have implemented dcpcrypt for an update file, but need the db encrypted now, I can try something with dcpcrypt I guess.
Beware: Do you want to encrypt the CONTENTS of the SQLite-Database, or the SQLite-Database itself?
dcpcrypt is for encrypting the CONTENT

See here for encrypting the DB itself:
https://github.com/sqlcipher
« Last Edit: August 08, 2024, 09:45:05 am by Zvoni »
One System to rule them all, One Code to find them,
One IDE to bring them all, and to the Framework bind them,
in the Land of Redmond, where the Windows lie
---------------------------------------------------------------------
Code is like a joke: If you have to explain it, it's bad

Guser979

  • Jr. Member
  • **
  • Posts: 64
Re: LAMW: Encrypt sqlite DB
« Reply #4 on: August 08, 2024, 12:53:21 pm »
Yes. Jpanel does have limits and can affect performance. In the project I mentioned, I didn't have any problems, even without having "cleaned" it. There are certainly redundancies, etc. I tested it thoroughly. Attached printscreen. It may also depend on the type of app and the response required during execution.

Yes. Chatgpt offers many approaches to what is asked. But over time I learned to "filter" his responses in order to make him focus on what I need.

In fact sqlcipher was chatgpt's proposal. I even tested including the dependency in build.gradlle. I imported what was necessary into the LAMW sqllitedataaccess.java code and compiled it.
 From this point on, you need to migrate the code to use sqlcipher. Chatgpt offered an example but I didn't go further due to lack of time.
« Last Edit: August 08, 2024, 12:57:01 pm by Guser979 »

c4p

  • Full Member
  • ***
  • Posts: 164
Re: LAMW: Encrypt sqlite DB
« Reply #5 on: August 08, 2024, 03:01:08 pm »
Sqlcipher looks like what I'm after.

Thanks @Zvoni @Guser979

Thanks, I have implemented dcpcrypt for an update file, but need the db encrypted now, I can try something with dcpcrypt I guess.
Beware: Do you want to encrypt the CONTENTS of the SQLite-Database, or the SQLite-Database itself?
dcpcrypt is for encrypting the CONTENT

See here for encrypting the DB itself:
https://github.com/sqlcipher
Lazarus 2.0.12 r64642/FPC 3.2.0 LAMW v0.8.6.4 on Windows 10+Linux Mint 21.2, projects mainly built using AppCompat and Gradle.

 

TinyPortal © 2005-2018