Forum Discussion

SidharthMishra's avatar
SidharthMishra
New Contributor
4 years ago

CryptoJS encryption in SoapUI (open source)

Hello,

 

Following is the code from the front-end of my application :

******************************************************

import * as cryptoJS from 'crypto-js';
 
secretkey: string = 'MySecretKey';
 
encryptText(value: string) {
let encryptText: string = cryptoJS.AES.encrypt(value, this.secretkey).toString();
return encryptText;
}
**********************************************
 
I need this to work in Groovy/Javascript in SoapUI(5.6.0)
 
I've already placed the crypto-js.jar ( https://jar-download.com/artifact-search/crypto-js
in C:\SmartBear\SoapUI-5.6.0\bin\ext
I failed to get the encryption.
 
NEED HELP!!
 
Thanks in advance.
 
 
  • richie's avatar
    richie
    Community Hero
    Hey SidharthMishra

    Soapui supports Java and groovy uses the Java runtime so ignoring other issues the Java code should work fine.

    Can you provide any logging when your script executes please?

    Also, can you provide a description of the testcase's test step hierarchy so we can understand whats actually going on with your testcase?

    Cheers,

    Rich


    • SidharthMishra's avatar
      SidharthMishra
      New Contributor

      Hi,

       

      The solution i got was..........

       

      I asked the developer to create a new API which would take any value/String as Request Payload and give its equivalent encryption as Response.

       

      Developer created an API with the same encryption logic/method used in the UI.

       

      Regards,

      Sidharth