AES Encryption and RSA encryption using Javascript

I want to use javascript policy to perform AES encryption on a json object. and RSA encryption on a string.
I do not want to use the java callout as it is not allowed as per security compliance.

I have used the crypto.js from internet and tried to use the INCLUDEURL tag in the JS policy but I am getting error in the library. Please help me with this scenario.

3 REPLIES 3


@darpanjain420 wrote:

I want to use javascript policy to perform AES encryption on a json object. and RSA encryption on a string.
I do not want to use the java callout as it is not allowed as per security compliance.

I have used the crypto.js from internet and tried to use the INCLUDEURL tag in the JS policy but I am getting error in the library. Please help me with this scenario.


You probably don't want to use JavaScript to perform encryption.  The reason for that is, it will not perform well at scale. 

I would like to ask what your actual goals are.  But because you say you want to do BOTH AES and RSA encryption, it sounds like you're just trying some things out, looking around.  Do you have any more specifics you can offer? 

In the past I've recommended using a Java callout for performing AES or RSA encryption.

 

I want to perform below logic:

Pass a JSON object to the API proxy and then generate a random string in runtime. RSA encrypt that string and AES encrypt the JSON object based on that random string.