sponsored links



No announcement yet.

Syncing RPG EBCDIC Decryption with PHP ASCII AES Encryption

  • Filter
  • Time
  • Show
Clear All
new posts

  • Syncing RPG EBCDIC Decryption with PHP ASCII AES Encryption

    If anybody has had experience with decrypting something on the IBM i that was encrypted on an ASCII platform, I would greatly appreciate your help.

    Here is what’s happening. Our PHP programmer is using the AES algorithm to encrypt a Social Security number. He is then encoding this to hex(ASCII) and then sending it through my web service to my RPGLE program.

    To test my side(the RPG side) I used Postman to call my web service and entered an ASCII Hex encoded, AES encrypted Social Security Number. In my RPGLE web service program, I take the ASCII Hex encoded AES encrypted Social Security Number and I convert it to EBCDIC Hex. Then I convert the EBCDIC Hex to character. I then decrypt the resulting character field back to the original Social Security Number and all of that works perfectly.

    The problem we are having is when the PHP programmer tries to encrypt the Social Security Number using AES and the same Mode, key, IV and block length, he is coming up with a different encrypted value than I do when I use the same AES encrypting with the same Key and IV and Mod and block length on the IBM i. Consequently when he Hex encodes it and send it to me through my web service and I convert it to EBCDIC Hex and then decrypt it with the same Mode, Key, IV, and block length, it fails.

    In other words we can't figure out why, when using the same encrypting algorithm (AES) and all the same parameters, he in PHP(ASCII) and me in RPG(EBCDIC), we come up with different encrypted values. I hope all of this make sense.