Encryption\Decryption between Java and Progress

Posted by runningtom8@gmail.com on 06-Oct-2015 14:55

We have a need to use cryptography between Java and Progress. In our case, Java encrypts a string and we need Progress to decrypt it. We are not able to do this.  Is this can be done?

We used the algorithm "AES_CBC_128". Our key was “1234567812345678”. Our IV Value was “1234567812345678”. We used same parameters for both Java encryption

Process and Progress encryption process, but these processes are producing different results when used to encrypt the same string. Code used to encrypt Progress is:

 

 

DEF VAR algo AS CHAR INIT "AES_CBC_128".                        

DEF VAR cipherText AS RAW.                                      

                                                                 

DEFINE VARIABLE cRawIV  AS CHARACTER NO-UNDO INITIAL            

"31323334353637383132333435363738".                             

                                                                 

LENGTH(encryptKey) = 16.                                        

PUT-BYTES(encryptKey,1) = HEX-DECODE(cRawIV).                   

                                                                 

LENGTH(ivValue) = 16.                                            

PUT-BYTES(ivValue,1) = HEX-DECODE(cRawIV).                      

                                                                 

cipherText = ENCRYPT("Test string", encryptKey, ivValue, algo). 

                                                                 

DEF VAR ax AS INTEGER NO-UNDO.                                  

ax = GET-BYTE(cipherText, 1).                                   

Display ax.

def var junk as char.                                           

junk = hex-encode(cipherText).                                   

display junk.     

Any suggestion?

Thank you

Y                                           

All Replies

Posted by Donicello Lampe on 06-Oct-2015 16:46

Looking at the following KBase article it seems that your IV should be "010203040506070809" instead:

knowledgebase.progress.com/.../000046096

This thread is closed