Wow - very nice.
How do you guys know all this stuff?? Very impressive.
I found several articles on Iseries SQL encryption, but nothing about "for bit data".
I have Conte's SQL/400 book and also Howard Arners - nothing about this (probably because ENCRYPT wasn't supported when published no doubt).
The Iseries SQL error description didn't help much.
I feel like I should be paying tuition on this list!!
From: midrange-l-bounces@xxxxxxxxxxxx [mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of CRPence
Sent: Friday, April 27, 2012 1:56 PM
Subject: Re: SQL encryption v5r4 error
On 27 Apr 2012 11:12, Stone, Joel wrote:
Any ideas what is incorrect ?
SET ENCRYPTION PASSWORD 'AAABBB'
create table jstone/fl2 (field1 char(20))
insert into fl2 (field1) values(Encrypt_RC2('TEST'))
select decrypt_char(field1) from fl2
Argument 01 of function DECRYPT_CHAR not valid.
what doesn't SQL like here??
The DECRYPT_CHAR argument-01 requires the CHAR to have been defined
as FOR BIT DATA.
Try the following variation. An extra modification has the date\type
attributes in a field, instead of as derived from a literal\constant as
assigned by the SQL:
set encryption password 'AAABBB'
create table fl2
( field1 char(20)
, field2 char(40 /*20+16+4*/) FOR BIT DATA
insert into fl2 (field1) values('TEST')
update fl2 set field2=Encrypt_RC2(field1)
select field1, decrypt_char(field2) as field2 from fl2