Page 1 of 1

Encryption

Posted: Mon 23 May 2016 09:27
by LHSoft
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?

Re: Encryption

Posted: Mon 23 May 2016 11:48
by MaximG
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)');

Re: Encryption

Posted: Mon 23 May 2016 12:43
by LHSoft
Hi,
thanks a lot, this helped.

best regards
Hans.

Re: Encryption

Posted: Wed 01 Jun 2016 07:08
by MaximG
We are glad to see the problem resolved. Please don't hesitate to contact us with questions concerning LiteDAC usage