Decryption Guide

Please refer below implementation guide for JWE / JWS.

NPM Librarylink icon - Above library carries basic understanding of JSON web encryption/decryption and its implementation in node.js. You can use this understanding to build your logic for other frameworks.

Note

alg : The alg (algorithm) identifies the cryptographic algorithm used to secure the JWE Encrypted Key. Please use following algorithm: RSA-OAEP-256

Note

enc : The encryption identifies the symmetric encryption algorithm used to secure the Ciphertext. Please use following encryption: A256GCM


Please refer below request body params for encrypted response:

Step 1
Receive encrypted payload
Step 2
Decrypt the Payload
Step 3
Use the decrypted response

Please refer below sample decryption algorithms:

Java

              
                import com.nimbusds.jose.JWEDecrypter;
import com.nimbusds.jose.JWEObject;
import com.nimbusds.jose.crypto.RSADecrypter;
import com.nimbusds.jose.jwk.JWK;
import com.nimbusds.jose.jwk.RSAKey;

public class JWEDecryption {

    public static void check() {
        // Please Enter your Jwe Payload here
        String jwePayload = "{insert your Jwe Payload here}}";
        try {
            // Please enter your Private Key here
            JWK privKey = RSAKey.parseFromPEMEncodedObjects("{insert your RSA public key here}");

            JWEObject jweObject = JWEObject.parse(jwePayload);

            JWEDecrypter decrypter = new RSADecrypter(privKey.toRSAKey());
            jweObject.decrypt(decrypter);

            String decryptedPayload = jweObject.getPayload().toString();
            System.out.println("Decrypted Payload: " + decryptedPayload);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
              

            
Last updated 2 years ago