RE: Using SuiteScript to encrypt a string as JWE
Hi everyone, I have a question regarding JWS and JWE using SuiteScript. Perhaps someone here can help me with their previous experience.
I’m currently working on a script to sign a payload using JWS. After signing, I need to encrypt it using JWE. I was able to accomplish the signing part by referring to an example I found on Stack Overflow, which I believe someone here may have answered.
However, I’m facing a challenge when it comes to using the built-in crypto module to encrypt the JWS payload in a JWE-compliant manner, using encryption algorithms like A256CBC-HS512 or RSA-OAEP-256. I haven’t been able to find a way or an example demonstrating this.
Does anyone here have experience with accomplishing this task? It goes without saying that I’m trying not to include any external library to achieve this.
Hi,
I think you might struggle to do this with the inbuilt crypto module but I think the crypto-js library might help:
https://cdnjs.cloudflare.com/ajax/libs/crypto-js/4.1.1/crypto-js.min.js
I’ve used this elsewhere for talks not converted by native functionality (and even some stuff that is!).
I hope that helps.
Thanks,
Chris