SQLite Android encryption
SQLite Android encryption
Hello!
I have noticed the ability of using Direct mode on Android platform appeared in the most recent update of liteDAC! Does that mean encription is working too?
If not how is it possible to use third-party driver with liteDAC to get encription on Android using RAD Studio XE7?
Thanks
I have noticed the ability of using Direct mode on Android platform appeared in the most recent update of liteDAC! Does that mean encription is working too?
If not how is it possible to use third-party driver with liteDAC to get encription on Android using RAD Studio XE7?
Thanks
Re: SQLite Android encryption
Hello,
Encryption is implemented by us in the Direct mode supported for Windows platforms only. For other platforms, you should use an external SQLite3 library with support for encryption. You can specify the SQLite3.dll location in the LiteConnection.ClientLibrary property.
Encryption is implemented by us in the Direct mode supported for Windows platforms only. For other platforms, you should use an external SQLite3 library with support for encryption. You can specify the SQLite3.dll location in the LiteConnection.ClientLibrary property.
Re: SQLite Android encryption
OK, many thanks, but how can i use alternative drivers on Android?
Should i use .dll or .so file?
Should i use .dll or .so file?
Re: SQLite Android encryption
For Android, libraries usually have the extension .so
Re: SQLite Android encryption
Can you show me some example how to connect to sqlite database using alternative library on Android?
I think about using SQLCipher open source but i don't see any .so files in it's distribution.
Maybe you can show with another library?
Thanks a lot
I think about using SQLCipher open source but i don't see any .so files in it's distribution.
Maybe you can show with another library?
Thanks a lot
Re: SQLite Android encryption
To work with third-party libraries, you should specify the path to the library in the LiteConnection.ClientLibrary property. We don't use and test our products on third-party libraries. You have to search for such libraries and test their functioning with LiteDAC.
Re: SQLite Android encryption
OK, thanks for your answer, one last question -
is it possible to use data encryption instead of database encryption on Android platform?
is it possible to use data encryption instead of database encryption on Android platform?
Re: SQLite Android encryption
Yes, you may use data encryption in mobile applications. More details about data encryption can be found in the documentation: http://www.devart.com/litedac/docs/encryption.htm
Re: SQLite Android encryption
Thank you for your answer, but i don't quite understand how to use it.
I have SQlite database file with tables Log, Backup, text.
I plased components UniConnection, UniQuery and Encryptor with options:
Now on ButtonPress i do
and got error "Field: test String value is too long: <lots of hieroglyphs>".
If I don't use DataTypeMap no error occured but still i can open database with external database administration tool and see that my data looks like ''123123 qwerty йцукен''.
What am i doing wrong? Can Encryptor handle with cirillic symbols?
I have SQlite database file with tables Log, Backup, text.
Code: Select all
CREATE TABLE [text] ([test] BINARY);
Code: Select all
object SQLLocal: TUniConnection
ProviderName = 'SQLite'
SpecificOptions.Strings = (
'SQLite.UseUnicode=True'
'SQLite.EnableLoadExtension=True')
Options.KeepDesignConnected = False
LoginPrompt = False
end;
object LocalDataSet: TUniQuery
LocalUpdate = True
Encryption.Fields = 'test'
Encryption.Encryptor = UniEncryptor
Connection = SQLLocal
Options.FieldsOrigin = True
end
object UniEncryptor: TUniEncryptor
Password = '1'
end
Code: Select all
localdataset.SQL.text:='INSERT INTO Text (test) VALUES (''123123 qwerty йцукен'')';
UniEncryptor.Password := '1';
localdataset.ExecSQL;
localdataset.SQL.text:='SELECT * FROM text';
localdataset.DataTypeMap.AddFieldNameRule ('test', ftwidestring);
localdataset.Open;
If I don't use DataTypeMap no error occured but still i can open database with external database administration tool and see that my data looks like ''123123 qwerty йцукен''.
What am i doing wrong? Can Encryptor handle with cirillic symbols?
Re: SQLite Android encryption
There is a sample of a console application demonstrating work with UniEncryption:
Code: Select all
program Project1;
{$APPTYPE CONSOLE}
uses
SysUtils,
Uni,
CREncryption,
SQLiteUniProvider,
windows;
var
UniConnection: TUniConnection;
UniQuery: TUniQuery;
UniEncryption: TUniEncryptor;
begin
UniConnection := TUniConnection.Create(nil);
try
UniConnection.ConnectString := 'ProviderName=SQLite;Data Source=:memory:;UseUnicode=true;LoginPrompt=False';
UniConnection.Connect;
UniConnection.ExecSQL('CREATE TABLE [test] ([txt] varchar2(2000))');
UniEncryption := TUniEncryptor.Create(nil);
UniEncryption.Password := '12345';
try
UniQuery := TUniQuery.Create(nil);
try
UniQuery.Connection := UniConnection;
UniQuery.Encryption.Encryptor := UniEncryption;
UniQuery.Encryption.Fields := 'txt';
UniQuery.SQL.Text := 'select * from test';
UniQuery.Open;
UniQuery.Insert;
UniQuery.Fields[0].AsString := 'test äöü эъя';
UniQuery.Post;
MessageBox(0, PChar(UniQuery.Fields[0].AsString), 'test', 0);
UniQuery.Close;
UniQuery.Encryption.Encryptor := nil;
UniQuery.Open;
MessageBox(0, PChar(UniQuery.Fields[0].AsString), 'test', 0);
UniQuery.Close;
finally
UniQuery.Free;
end;
finally
UniEncryption.Free;
end;
finally
UniConnection.Free;
readln;
end;
end.