Encrypting field data in a pre-existing table

Discussion of open issues, suggestions and bugs regarding IBDAC (InterBase Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
monkeymynd
Posts: 12
Joined: Thu 04 Dec 2008 23:08

Encrypting field data in a pre-existing table

Post by monkeymynd » Fri 31 Aug 2012 14:24

I am currently demoing the latest version of IBDAC components which includes the TIBCEncryptor component. I have followed the example in the new help file, and am able to encrypt any new data entered into the fields, but I would like to know how to encrypt all of the pre-existing data.

For example...

Say I started with the following:

CREATE TABLE CLIENTS (
CLIENT_ID INTEGER NOT NULL PRIMARY KEY,
CLIENT_NAME VARCHAR(200),
PHONE_1 VARCHAR(12),
PHONE_2 VARCHAR(12)
)

There are many records with phone numbers already existing.

Now, before setting up the new encryption, I am running the following...

ALTER TABLE CLIENTS ALTER COLUMN PHONE_1 TYPE VARCHAR(200) CHARACTER SET OCTETS;
ALTER TABLE CLIENTS ALTER COLUMN PHONE_2 TYPE VARCHAR(200) CHARACTER SET OCTETS;

Next, I point the query to the IBCEncryptor and set the proper options to encrypt PHONE_1 & PHONE_2.

If I change or alter one of the phone #'s and post the record, the data becomes encrypted as expected, but the other field that was not changed remains unencrypted.

Is there a way for me to call a procedure or update all existing data in the fields which I want to be encrypted? I tried using an sql query to set the data equal to itself, ex. SET PHONE_1 = PHONE_1, but that did not encrypt the data. These are large tables and I would like to make sure all of the existing data is encrypted before new rows are added.

Any suggestions/examples would be greatly appreciated.

[Edit] Also, when using the tag & hash method, is there a way to tell if the field data is encrypted? A function or something? Thanks.

AndreyZ

Re: Encrypting field data in a pre-existing table

Post by AndreyZ » Mon 03 Sep 2012 12:06

For the time being, there is no possibility to encrypt a table otherwise than editing and posting its records. We will add the possibility to encrypt a whole table and the possibility to determine if data in a field is encrypted to one of the next builds of all DAC products.

alexhaifa
Posts: 18
Joined: Thu 29 May 2014 12:48

Re: Encrypting field data in a pre-existing table

Post by alexhaifa » Tue 03 Mar 2015 17:29

Hello,

this function was implamented ? Is it possible now to encrypting a pre existing table?

thanks
Alex

ViktorV
Devart Team
Posts: 3168
Joined: Wed 30 Jul 2014 07:16

Re: Encrypting field data in a pre-existing table

Post by ViktorV » Wed 04 Mar 2015 09:42

We have added a capability for encryption of tables and datasets and a capability to detect whether data of a particular field is encrypted in IBDAC 5.0.1.
You can encrypt an existing table using the TIBCConnection.EncryptTable or TCustomIBCDataSet.Encryption.EncryptDataSet methods.
The TCustomIBCDataSet.Encryption.IsFieldEncrypted method allows to detect whether data in a particular field is encrypted.

alexhaifa
Posts: 18
Joined: Thu 29 May 2014 12:48

Re: Encrypting field data in a pre-existing table

Post by alexhaifa » Wed 06 Jul 2016 23:50

Hello,

Could you give me the example how to use the :

IBCConnection1.EncryptTable('CADPAL', ?????????, 'PALAVRA_EST');

I didn't find any help on this functionaly

Thanks

ViktorV
Devart Team
Posts: 3168
Joined: Wed 30 Jul 2014 07:16

Re: Encrypting field data in a pre-existing table

Post by ViktorV » Thu 07 Jul 2016 11:33

Thank you for being interested in our products.
The TIBCConnection.EncryptTable(const TableName: string; Encryptor: TIBCEncryptor; const Fields: string) method encrypts a previously created table.
Parameters:
TableName - the name of the encrypted table;
Encryptor - the TIBCEncryptor component that will be used to encrypt the table;
Fields - the list of fields to be encrypted.
See more details about data encryption in the IBDAC documentation: http://www.devart.com/ibdac/docs/encryption.htm

Post Reply