TUniEncryptor Sample.

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
especialista
Posts: 6
Joined: Fri 06 Jul 2012 23:46

TUniEncryptor Sample.

Post by especialista » Fri 06 Jul 2012 23:58

Is there any example regarding TUniEncryptor?
I'm not able to figure out how it works.. :oops:

Thanks in advance!

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: TUniEncryptor Sample.

Post by AlexP » Mon 09 Jul 2012 09:06

hello,

Please specify your database name.

especialista
Posts: 6
Joined: Fri 06 Jul 2012 23:46

Re: TUniEncryptor Sample.

Post by especialista » Mon 09 Jul 2012 12:05

AlexP wrote:Please specify your database name.
Firebird, v2.5

AndreyZ

Re: TUniEncryptor Sample.

Post by AndreyZ » Mon 09 Jul 2012 12:41

Table example:

Code: Select all

CREATE TABLE EMP (
  EMPNO INTEGER NOT NULL PRIMARY KEY,
  ENAME CHAR(2000) CHARACTER SET OCTETS COLLATE OCTETS,
  HIREDATE CHAR(200) CHARACTER SET OCTETS COLLATE OCTETS,
  SAL CHAR(200) CHARACTER SET OCTETS COLLATE OCTETS,
  FOTO BLOB SUB_TYPE 0
)
Code example:

Code: Select all

UniQuery.SQL.Text := 'SELECT * FROM EMP';

UniQuery.Encryption.Encryptor := UniEncryptor;
UniQuery.Encryption.Fields := 'ENAME, HIREDATE, SAL, FOTO';
UniEncryptor.Password := '11111';

UniQuery.DataTypeMap.AddFieldNameRule ('ENAME', ftString);
UniQuery.DataTypeMap.AddFieldNameRule ('HIREDATE', ftDateTime);
UniQuery.DataTypeMap.AddFieldNameRule ('SAL', ftFloat);

UniQuery.Open;
For more information, please read the "Working with Data Encryption" and "Working with Data Type Mapping" articles in the UniDAC documentation.

especialista
Posts: 6
Joined: Fri 06 Jul 2012 23:46

Re: TUniEncryptor Sample.

Post by especialista » Mon 09 Jul 2012 14:31

Thank you very much for your kindness!
I've tried a "copy and paste" of your code and it returns the message:

First chance exception at $7C812AFB. Exception class EUnsupportedDataTypeMapping with message 'Unsupported data type mapping: "CharBin(200)" to "DateTime"'. Process Project1.exe (3808)

AndreyZ

Re: TUniEncryptor Sample.

Post by AndreyZ » Tue 10 Jul 2012 07:57

We have fixed this problem with Data Type Mapping. This fix will be included in the next UniDAC build. We are going to release UniDAC approximately in two or three weeks. For the time being, you can use the following table:

Code: Select all

CREATE TABLE EMP (
  EMPNO INTEGER NOT NULL PRIMARY KEY,
  ENAME VARCHAR(2000) CHARACTER SET OCTETS COLLATE OCTETS,
  SAL VARCHAR(200) CHARACTER SET OCTETS COLLATE OCTETS,
  FOTO BLOB SUB_TYPE 0
)
, and the following code:

Code: Select all

UniQuery.SQL.Text := 'SELECT * FROM EMP';

UniQuery.Encryption.Encryptor := UniEncryptor;
UniQuery.Encryption.Fields := 'ENAME, SAL, FOTO';
UniEncryptor.Password := '11111';

UniQuery.DataTypeMap.AddFieldNameRule ('ENAME', ftString);
UniQuery.DataTypeMap.AddFieldNameRule ('SAL', ftFloat);

UniQuery.Open;

especialista
Posts: 6
Joined: Fri 06 Jul 2012 23:46

Re: TUniEncryptor Sample.

Post by especialista » Tue 10 Jul 2012 23:07

AndreyZ wrote:We have fixed this problem with Data Type Mapping.
I followed your steps to the letter.
Working great with varchar fields.
SAL field retuns "Invalid binary value" error.
Let's wait for the next release.
Thanks in advance

AndreyZ

Re: TUniEncryptor Sample.

Post by AndreyZ » Wed 11 Jul 2012 07:13

Please specify the following:
- the exact value you tried to set to the SAL field;
- the exact version of your IDE.

especialista
Posts: 6
Joined: Fri 06 Jul 2012 23:46

Re: TUniEncryptor Sample.

Post by especialista » Wed 11 Jul 2012 14:58

Image
Tried to set SAL = 0. Any value gives the same result.
Delphi XE2 Update 4 Hotfix 1.
Firebird 2.5.1

AndreyZ

Re: TUniEncryptor Sample.

Post by AndreyZ » Thu 12 Jul 2012 11:58

Thank you for the information. We have reproduced and fixed this problem. This fix will be included in the next UniDAC build.

especialista
Posts: 6
Joined: Fri 06 Jul 2012 23:46

Re: TUniEncryptor Sample.

Post by especialista » Thu 12 Jul 2012 15:24

AndreyZ wrote:Thank you for the information. We have reproduced and fixed this problem. This fix will be included in the next UniDAC build.
My pleasure!
Thank you for promptly answers!
Best wishes!

AndreyZ

Re: TUniEncryptor Sample.

Post by AndreyZ » Thu 12 Jul 2012 16:27

Feel free to contact us if you have any further questions about UniDAC.

Post Reply