Convert base64 to hex.

Abhijit Das7
Tera Expert

Hi Everyone,

 

I am generating HMAC signature in base64 format and I want to convert it into hex.

 

Script Include:

var hmacjs = Class.create();
hmacjs.prototype = Object.extendsObject(global.AbstractAjaxProcessor, {
    hmacSHA256: function() {
        gs.info("entered hmac script");
         var key = this.getParameter('sysparm_key');
        // var signatureStr = this.getParameter('sysparm_strg');
        var mac = new CertificateEncryption();
		//var key = "sample_key";
        key = gs.base64Encode(key);
        var hMac = mac.generateMac(key, 'HmacSHA256', "sample_data"); // want to convert the base64 value generating here to hex.
        gs.info("hmac = " + hMac);
        return hMac;

    },

   

    type: 'hmacjs'


});

 

How can I convert this base64 value into hex.

 

cc: @Ankur Bawiskar @chrisperry 

 

Thanks in advance

0 REPLIES 0