Field Encryption

Discussion of open issues, suggestions and bugs regarding SDAC (SQL Server Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
OlliWW
Posts: 25
Joined: Mon 25 Mar 2013 17:03

Field Encryption

Post by OlliWW » Fri 18 Aug 2017 15:27

Hello,

According to this site:
https://www.devart.com/sdac/docs/?encryption.htm

I'm trying to setup encryption for one column of my table.

I've setup a varbinary(200) column but when i try something like this:

Code: Select all

qry.CommandText := 'update mytab set encryptionfield = :field where ID = 1'
qry.Encryption.Encryptor := MSEncryptor;
qry.Encryption.Fields := 'encryptionfield';
qry.Password := '11111';
qryDataTypeMap.AddFieldNameRule ('encryptionfield', ftString);
qry.Parameters.ParamByName('field').AsString := 'Do something';
qry.Execute;
...
SDAC tells me when executing a statement like above:
Can not convert nvarchar in varbinary

azyk
Devart Team
Posts: 1119
Joined: Fri 11 Apr 2014 11:47
Location: Alpha Centauri A

Re: Field Encryption

Post by azyk » Mon 21 Aug 2017 10:21

You get the specified error message, because in your sample you pass a value to the dataset parameter, but when using SDAC Data Encryption you should pass a value to the dataset field. Currenlty, the parameters encryption in SDAC Data Encryption is under development.

To change the encrypted field value in your sample, use the dataset methods Edit .. Post, and as the TMSQuery.SQL.Text SELECT value SELECT SQL query instead of UPDATE. For example:

Code: Select all

qry.SQL.Text := 'select ID, encryptionfield from mytab where ID = 1';
qry.Encryption.Encryptor := MSEncryptor;
qry.Encryption.Fields := 'encryptionfield';
qry.Encryption.Encryptor.Password := '11111';
qry.DataTypeMap.AddFieldNameRule ('encryptionfield', ftString);

qry.Open;
qry.Edit;
qry.FieldByName('encryptionfield').AsString := 'Do something';
qry.Post;

OlliWW
Posts: 25
Joined: Mon 25 Mar 2013 17:03

Re: Field Encryption

Post by OlliWW » Mon 21 Aug 2017 11:43

Thank you for your reply.

I think i got it, but this is not very usefull...when will an update or insert be ready with parameters?

azyk
Devart Team
Posts: 1119
Joined: Fri 11 Apr 2014 11:47
Location: Alpha Centauri A

Re: Field Encryption

Post by azyk » Tue 22 Aug 2017 10:06

At the moment the development of encryption parameters in SDAC Data Encryption is not a priority, so we cannot tell you the terms of its implementation.

However, you can leave your suggestion for implementing this functionality at our UserVoice ( http://devart.uservoice.com/forums/1046 ... components ). If the suggestion receives a sufficient number of votes, we will consider the possibility of its implementation.

Post Reply