On Monday, May 21, 2012 9:09:46 AM UTC-7, Roy Hann wrote:
> Ingres Forums wrote:
>
> > Have you tried function encryption? I don't think you'd have the same
> > problem with foreign key constraints.
>
> That's a good thought but it would require a table scan to join angels
> and sins (which in this particular case is probably tolerable). The
> show-stopper is that I can't enforce a referential integrity
> constraint if I do that.
>
> Just to make it clear, properly authorised users are allowed to see all
> the data. I just need to ensure that if the database is physically
> released (i.e. on a stolen laptop), that no one can tell which angels
> are sinners.
>
> One important detail I omitted to mention is that the identity of the
> angels is a matter of public record.
>
> For now, in spite of the fact that the public is permitted to know who
> the angels are, I've decided to encrypt the many identifying
> attributes. To my mind concealing the bit people are allowed to know is
> going about the problem backwards.
>
> It's not a big deal. It's just that the first time I've tried to use
> encryption it doesn't seem to suit my problem.
I think what you want is possible, you may have been hitting:
E_US24C3 Invalid encrypted index. An encrypted index must: (1) contain
only one column, (2) that column must be encrypted with NOSALT, (3) the
index must be of structure HASH.
Here is what I think you wanted (hacked up from another demo), NOTE I've commented out DDL that could hide the pk in the public angels tables (which you said you explicitly did not want to do) just in case.
How does the SQL at end if mail work for you?
Chris
/*
https://groups.google.com/forum/?fromgroups#!topic/comp.databases.ingres/VyLKfd1w9hU
** Ingres 10.0 encrypted columns
**
http://community.ingres.com/wiki/Data_at_Rest_Encryption
*/
DROP TABLE angels;
\p\g
DROP TABLE sins;
\p\g
\nocontinue
CREATE TABLE angels
(
fname CHAR(10),
lname CHAR(20),
socsec CHAR(11) NOT NULL /* ENCRYPT NOSALT */ ,
primary key (socsec) WITH STRUCTURE = HASH
)
/* optionaly hide the public key
WITH ENCRYPTION=AES128,
PASSPHRASE='this is a secret';
*/
\p\g
/* provide pass key - allow access to table */
/*
MODIFY angels ENCRYPT
WITH PASSPHRASE='this is a secret';
\p\g
*/
CREATE TABLE sins
(
info CHAR(20), /* presumably the nature of the sin should be encrypted too */
socsec CHAR(11) ENCRYPT NOSALT,
FOREIGN KEY (socsec) REFERENCES angels(socsec) ON DELETE CASCADE WITH STRUCTURE = HASH
)
WITH
ENCRYPTION=AES128,
PASSPHRASE='this is a secret';
\p\g
help TABLE sins\p\g
/* provide pass key - allow access to table */
MODIFY sins ENCRYPT
WITH PASSPHRASE='this is a secret';
\p\g
insert into angels (fname, lname, socsec) values ('John', 'Smith', '012-33-4567');
\p\g
insert into angels values ('Fred', 'Smith', '012-33-4568');
\p\g
insert into sins values ('owns a dog', '012-33-4567');
\p\g
select * from angels;
\p\g
select * from sins;
\p\g
select angels.fname, angels.lname,
sins.info from angels, sins where angels.socsec = sins.socsec;
\p\g
/* revoke pass key (use invalid key) - forbid to table */
MODIFY angels ENCRYPT
WITH PASSPHRASE='';
\p\g
MODIFY sins ENCRYPT
WITH PASSPHRASE='';
\p\g
select * from angels;
\p\g