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
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).
def var junk as char.
junk = hex-encode(cipherText).
Looking at the following KBase article it seems that your IV should be "010203040506070809" instead: