You can't tell DB2 to encrypt a column. You have to do the encryption in the application. We wrote an RPG app with embedded SQL to encrypt and decrypt data. We call it from any app that needs to write encrypted data to the database. It accepts the ENCRYPTD/DECRYPT option and the unencrypted data, encrypts it and sends it back. The calling app then writes it to the database. Any app that needs to decrypt that data reads the database, calls the app which decrypts the data and passes it back. For encrypt/decrypt part is easy. Getting the database field size right to hold the encrypted data is a little tricky. Our app has some other code that I don't show to get the encryption password, and does some testing to see what app is calling it and only lets ones it knows about use it's function for a little added security

/free

If Function = 'ENCRYPT';
EXEC SQL SET :ResultVarying = ENCRYPT_TDES(:InputVarying, :pw);
Endif;

If Function = 'DECRYPT';
EXEC SQL SET :ResultVarying = DECRYPT_CHAR(
cast(:InputVarying as char(5000) for bit data), :pw);
Endif;

/end-free

-----Original Message-----
From: midrange-l-bounces@xxxxxxxxxxxx [mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of Charles Wilt
Sent: Wednesday, October 22, 2008 4:29 PM
To: Midrange Systems Technical Discussion
Subject: Re: Using encryption/decryption of column data via a program

How did you encrypt the column in the table?

Charles

On Wed, Oct 22, 2008 at 3:46 PM, Dave Odom <Dave.Odom@xxxxxxxxxxxx> wrote:
Is there a IBM i function/command that will allow encryption/decryption of column data on the i, especially in conjunction with REXX and/or SQL? I want to have my REXX/FTP programs encrypt and decrypt a password stored in a table. I don't want to have to use any Windows program or any of its functions, just functions/commands/programs in one of the native languages on the i.

Thanks in advance,

Dave
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/midrange-l.


--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/midrange-l.


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.