Page 1 of 1

Field Encryption

Posted: Fri 18 Aug 2017 15:27
by OlliWW
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

Re: Field Encryption

Posted: Mon 21 Aug 2017 10:21
by azyk
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;

Re: Field Encryption

Posted: Mon 21 Aug 2017 11:43
by OlliWW
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?

Re: Field Encryption

Posted: Tue 22 Aug 2017 10:06
by azyk
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.