Encryption

Discussion of open issues, suggestions and bugs regarding LiteDAC (SQLite Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
LHSoft
Posts: 130
Joined: Sat 18 Aug 2012 08:33

Encryption

Post by LHSoft » Mon 23 May 2016 09:27

Hello
I create a new database and try encryption like described:

Code: Select all

LiteConnection1.ClientLibrary := ExtractFilePath(ParamStr(0)) + 'sqlite3.dll';
  LiteConnection1.Database := ExtractFilePath(ParamStr(0)) + 'test3.db3';
  LiteConnection1.Options.ForceCreateDatabase := True;
  LiteConnection1.EncryptionKey := '1234';
  LiteConnection1.Options.EncryptionAlgorithm := TLiteEncryptionAlgorithm.leBlowfish;
  LiteConnection1.Options.Direct := True;
  LiteConnection1.Open;
Result: Database is not encrypted, I can open it with SQLLiteBrowser without any key.
If doing on an existing database:

Code: Select all

LiteConnection1.EncryptDatabase('1234');
it is encrypted but I can not open it with SQLLiteBrowser any more. (maybe pagesize).
It is necessary to encrypt the whole database because it must be sure noone can alter table contents and not delete rows too (point of sale application).
Im using 10 Seattle (with 10.1 Berlin I can not start the application) and test component.
Can you help me?

MaximG
Devart Team
Posts: 1822
Joined: Mon 06 Jul 2015 11:34

Re: Encryption

Post by MaximG » Mon 23 May 2016 11:48

The code fragment you provided will create an empty file test3.db3 (its size will be 0). Therefore, despite using encryption, it will be opened in any db-utility with support for SQLite. Try to create a custom DB object after opening connection and make sure the created test3.db3 file is encrypted.

LiteConnection1.Open;
LiteConnection1.ExecSQL('CREATE TABLE MYTABLE (MYFIELD INTEGER)');

LHSoft
Posts: 130
Joined: Sat 18 Aug 2012 08:33

Re: Encryption

Post by LHSoft » Mon 23 May 2016 12:43

Hi,
thanks a lot, this helped.

best regards
Hans.

MaximG
Devart Team
Posts: 1822
Joined: Mon 06 Jul 2015 11:34

Re: Encryption

Post by MaximG » Wed 01 Jun 2016 07:08

We are glad to see the problem resolved. Please don't hesitate to contact us with questions concerning LiteDAC usage

Post Reply