I went thru this about three years ago. The main thing is that the ENCYPT
Routines that you call in UniBasic did not work until 7.15 I think.

Before that time I had to use an EXECUTE and use a third party encryption
routine. After the 7.15 release it has work fine for over a year maybe year
and a half.
George

-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Rex Gozar
Sent: Thursday, March 04, 2010 9:04 AM
To: U2 Users List
Subject: Re: [U2] Examples of working ENCRYPT function?

Kevin,

For what it's worth, I'm posting some code we have working here.  A 
couple things to note: (a) the encryption process passes back 
non-printable characters along with the base64 that breaks the 
decryption process, so I strip them out. (b) I've noticed that some 
algorithms supported on earlier releases are not supported on later ones.

Universe 10.1.18 (Windows)

       FUNCTION ENCRYPT64(TEXT)
*
       EQU ALGORITHM$ TO "RC4"
       EQU ACTION$ENCRYPT TO 1
       EQU ACTION$ENCRYPT.BASE64 TO 2
       EQU ACTION$DECRYPT TO 3
       EQU ACTION$DECRYPT.BASE64 TO 4
       EQU DATALOC$STRING TO 1
       EQU DATALOC$FILE TO 2
       EQU KEY$ TO "ABCDEFGHIJKLMNOP"
       EQU KEYLOC$DATA TO 1
       EQU KEYLOC$FILE TO 2
       EQU KEYACTION$ACTUAL.KEY TO 1
       EQU KEYACTION$DERIVE.KEY TO 2
       EQU SALT$ TO ""
       EQU IV$ TO ""
       EQU RESULTLOC$STRING TO 1
       EQU RESULTLOC$FILE TO 2
*
       IF UNASSIGNED(TEXT) THEN
          ABORTM "TEXT IS UNASSIGNED!"
       END
       IF TEXT = "" THEN
          RETURN ("")
       END
*
       RESULT = ""
*
       ERRCODE = ENCRYPT(ALGORITHM$, ACTION$ENCRYPT.BASE64,
          (TEXT), DATALOC$STRING,
          KEY$, KEYLOC$DATA, KEYACTION$ACTUAL.KEY,
          SALT$, IV$,
          RESULT, RESULTLOC$STRING)
*
       IF ERRCODE THEN
          ABORTM "ENCRYPT64: ERRCODE ":ERRCODE
       END
*
* get rid of non-printable characters
*
       RESULT = OCONV(RESULT, "MCP")
       CONVERT "." TO "" IN RESULT
*
* return to caller
*
       RETURN (RESULT)
    END


Kevin King wrote:
> Thanks Bob.  I'm at the "giving up" stage with Unidata 6.1 on AIX.
> Besides, I need something that can span a few different releases so I'm
> looking elsewhere.
> 
> -Kevin
> http://www.PrecisOnline.com
> _______________________________________________
> U2-Users mailing list
> [email protected]
> http://listserver.u2ug.org/mailman/listinfo/u2-users
> 

_______________________________________________
U2-Users mailing list
[email protected]
http://listserver.u2ug.org/mailman/listinfo/u2-users

_______________________________________________
U2-Users mailing list
[email protected]
http://listserver.u2ug.org/mailman/listinfo/u2-users

Reply via email to