|
On 13-Apr-2015 15:27 -0500, CRPence wrote:
On 13-Apr-2015 14:56 -0500, RWesh wrote:<<SNIP>>
I used Listing 3 in the following link to create a FIELDPROC
program QGPL/MOBHOMEPAS which should encrypt a variable char
column
<http://www.ibm.com/developerworks/data/library/techarticle/dm-1101encryptenhance/#icomments>
I compiled the RPGLE program and I created a separate database
DBMLIB/UMAAAP00 for testing as follows
A R UMAAAF00 TEXT('-
A TEST ENCRYPTION')
A*
A IPIAAA 20A VARLEN(20)
A KYGAAA 11S 2 COLHDG('SALARY')
I then use STRSQL to alter the table and 'protect' field IPIAAA
ALTER TABLE DBMLIB/UMAAAP00
alter column IPIAAA set FIELDPROC QGPL.MOBHOMEPAS
ALTER COMPLETED FOR TABLE UMAAAP00 IN DBMLIB.
For some reason when I go in to add entries through UPDDTA
directly to the file itself and then do a WRKQRY to query the
file and view them I don't see them as encrypted.
<<SNIP>>
<<SNIP>>
Anyhow, the sample programs at that URL will *unconditionally*
perform the /decryption/; e.g. for the "Listing 3" example program
[asterisks added for emphasis] does the inverse action that was
performed during the /encryption/ so the effects can be easily
tested for round-trip:
"...
ElseIf FuncCode = 4 ; // decode
...
// in this example, *reverse the characters as decryption*
..."
<<SNIP>>
I have adjusted my program and it is now set up to encode and fully
decode a password field (PASAAA) for authorized users while masking
some of the password to unauthorized users when decoding.
I can see this when I perform the SQL Statement:
SELECT * FROM DBMLIB/UMAAAP00
The first four characters of the password are masked with asterisks.
I also get the expected result when I perform a 'Data Transfer From
Iseries' on this particular file into Excel using the "Receive"
button
The issue that I am having now is that I am not seeing similar
results for the commands: UPDDTA DBMLIB/UMAAAP00 and WRKQRY on that
particular file.
Both of these commands seem to decode the passwords in full while I
am expecting it to be masked as well.
I have included my code below which I got help with via
<http://www.mcpressonline.com/rpg/db2-field-procedures-finally-support-conditional-masking.html>
<<SNIPped most of the code>>
ElseIf FuncCode = 4 ;
En_Ary_p = %Addr(EnCodDta);
De_Ary_p = %Addr(DeCodDta);
d = 1 ;
For e = EnCodTyp.SQLFL-1 By 2 DownTo 1;
De_Ary(d) = En_ary(e);
d += 1;
Endfor;
// If SqFPInfo.SQLFNM = '0';
// If currentUserfromPSDS<>'QSECOFER' and
// currentUserfromPSDS<>'SECADMIN';
%Subst(DeCodDta:1:4) = '****';
// Endif;
// Endif;
Else;
SqlState = '38003' ;
Endif;
Return;
/End-Free
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 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.