API Connect

 View Only
  • 1.  Encrypt/ Decrypt payload using AES256 CBC algorithm

    Posted Thu September 22, 2022 02:26 AM
    Hello Team,

    We need to Encrypt and Decrypt payload using AES256 CBC mode algorithm.
    We don't have IV value to decrypt data.
    We able to encrypt data without IV ,but when we decrypt data We are getting error i.e IV is required.
    We are Using below method to decrypt data.

    Method: crypto.createDecipheriv('aes256-cbc',key,iv); 
    Error    :
    Incorrect number of arguments provided to function 'createDecipheriv()'. Expected number of arguments: 3; actual number of arguments: 2


    Please guide how to encrypt/decrypt data using AES 256 CBC algorithm in IBM API connect v10?
    Also can we decrypt data without IV? if yes, then how to decrypt it.

    ------------------------------
    Jyoti Yadav
    ------------------------------


  • 2.  RE: Encrypt/ Decrypt payload using AES256 CBC algorithm

    Posted Fri September 23, 2022 01:35 AM
    Dear Jyoti,

    Best way to encrypt payload is to first concatenate any random alphanumeric 16 byte string at start of your original payload, then pass it to Encryption function. This will also then help you to not depend on sharing IV with client applications.This will even also help you not loosing important initial 16 byte of original payload.

    Decryption :- make sure you are passing key & IV as buffer.

    ------------------------------
    Jayprakash Yadav
    ------------------------------



  • 3.  RE: Encrypt/ Decrypt payload using AES256 CBC algorithm

    Posted Wed September 28, 2022 08:02 AM
    Hello Team,

    Please guide how to decrypt payload without IV?

    Thanks,
    Jyoti 






  • 4.  RE: Encrypt/ Decrypt payload using AES256 CBC algorithm

    Posted Mon October 03, 2022 08:54 AM
    Hello IBM Community,

    At client end, they are encrypt payload without IV ( used only key) for "AES256-CBC" algorithm.
    When we try to decrypt it using gatewayscript (crypt module), IV is mandatory field for crypto. createDecipheriv() method.

    Please guide is there any way to decrypt payload without IV.

    When we try to decrypt payload on Datapower, payload is decrypted but 1 block of data ( 16 characters) is messing.


    Thanks and Regards,
    Jyoti

    On Wed, Sep 28, 2022, 5:32 PM Jyoti Yadav <yadavjiya1995@gmail.com> wrote:
    Hello Team,

    Please guide how to decrypt payload without IV?

    Thanks,
    Jyoti 






  • 5.  RE: Encrypt/ Decrypt payload using AES256 CBC algorithm

    Posted Tue October 04, 2022 03:01 AM
    I have already shared the workaround to solve this issue. Please read properly once again.
    Ask your client concatenate random 16 byte string at start of Payload, then encrypt it.

    Post than while decrypting at your end you can pass any random IV to decrypt, also in result of decryption, you can remove random string from it.

    ------------------------------
    Jayprakash Yadav
    ------------------------------