We have this working perfectly on Universe 10

Code snippets follow:

ENCRYPT

SUBROUTINE EWENCRYPT(DATASTRING,OPSTRING,RETURN.CODE)

      RESULT=""
      ALGORITHM="rc2-cbc"                            ; * 128 bit rc2
algorithm in CBC mode
      MYKEY="4142434445464748494A4B4C4D4E4F50"  ; * HEX - Actual Key
      IV=   "4142434445464748"                 ; * HEX - Initialization
Vector
      DATALOC=1                                         ; * Data in
String
      KEYLOC=1                                        ; * Key in String
      ACTION=2                                     ; * Base64 encode
after encryption
      KEYACTION=1                               ; * KEY_ACTUAL_OPENSSL
      SALT=''                                 ; * SALT not used
      RESULTLOC=1                               ; * Result in String
RESULT
      OPSTRING = ''
 
RETURN.CODE=ENCRYPT(ALGORITHM,ACTION,DATASTRING,DATALOC,MYKEY,KEYLOC,KEY
ACTION,SALT,IV,OPSTRING,RESULTLOC)
      RETURN
   END

DECRYPT

SUBROUTINE EWDECRYPT(DATASTRING,OPSTRING,RETURNCODE)

      RESULT=""
      ALGORITHM="rc2-cbc"                            ; * 128 bit rc2
algorithm in CBC mode
      MYKEY="4142434445464748494A4B4C4D4E4F50"  ; * HEX - Actual Key
      IV=   "4142434445464748"                 ; * HEX - Initialization
Vector              ; * Data String
      DATALOC=1                                         ; * Data in
String
      KEYLOC=1                                        ; * Key in String
      ACTION=2                                     ; * Base64 encode
after encryption
      KEYACTION=1                               ; * KEY_ACTUAL_OPENSSL
      SALT=''                                 ; * SALT not used
      RESULTLOC=1                               ; * Result in String
RESULT
      ACTION="4"                                        ; * Base64
decode before encryption
      OPSTRING = ''
 
RETURN.CODE=ENCRYPT(ALGORITHM,ACTION,DATASTRING,DATALOC,MYKEY,KEYLOC,KEY
ACTION,SALT,IV,OPSTRING,RESULTLOC)
      FinalTime=SYSTEM(9)               ; * Time program ran in
milliseconds

      RETURN

   END

Bob



-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Kevin King
Sent: 01 March 2010 22:47
To: U2 Users List
Subject: [U2] Examples of working ENCRYPT function?

Unidata 6.1.17; Trying to get the ENCRYPT function working, no love.  I
have
all of the parameters set to what I believe is correct (but of course
the
documentation is notably ambiguous on a number of details).  At this
point
I'm just trying to get a simple rc4 working, but the result is coming
back
as 1 (invalid cipher).

Any clues, insights, assistance would be most appreciated.

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

______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
______________________________________________________________________

Confidentiality Notice:  This e-mail and any attachments are intended solely 
for the addressee and may contain confidential or privileged  information.   If 
you are not the named addressee, or the person responsible for delivering the 
message to the named addressee, please notify the sender as soon as possible 
and delete the material from your computer.  This message will be protected by 
copyright.  If it has come to you in error, you must not take any action based 
on its contents nor must you copy or show the message to any person other than 
the intended recipient. 
_____________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
______________________________________________________________________
_______________________________________________
U2-Users mailing list
[email protected]
http://listserver.u2ug.org/mailman/listinfo/u2-users

Reply via email to