Guidline How to Using External Lib JSENScrypt in postman

  1. URL to get jsEncrypt lib: https://raw.githubusercontent.com/travist/jsencrypt/master/bin/jsencrypt.js

  2. save URL at step 1 in global Varaible with name “jsEncrypt”;

  3. In Pre-request Script, write script as below:

    navigator  = {};
    window = {};
    pm.sendRequest(pm.globals.get("jsEncrypt"), (err, res) => {
    var text = res.text();
    (new Function(text))();
    var jsencrypt = new JSEncrypt.JSEncrypt({
            default_key_size: 4096
    });
    jsencrypt.setKey( "// here is public key" );
    var result = jsencrypt.encrypt("// here is you clear value before you want to encrypt");
    console.log(CryptoJS.enc.Base64.parse(result).toString());

Hope can help you all.