Microsoft JScript runtime error Object doesn't support this property or method

Posted by Darxval on Stack Overflow See other posts from Stack Overflow or by Darxval
Published on 2010-06-01T20:44:20Z Indexed on 2010/06/01 20:53 UTC
Read the original article Hit count: 215

Filed under:

So i am trying to call this function in my javascript but it gives me the error of "Microsoft JScript runtime error Object doesn't support this property or method" and i cant figure out why. It is occuring when trying to call hmacObj.getHMAC. This is from the jsSHA website: http://jssha.sourceforge.net/ to use the hmac-sha1 algorithm encryption. Thank you!

hmacObj = new jsSHA(signature_base_string,"HEX");

signature = hmacObj.getHMAC("hgkghk","HEX","SHA-1","HEX");

Above this i have copied the code from sha.js

snippet:

function jsSHA(srcString, inputFormat) {

 /*
  * Configurable variables. Defaults typically work
  */
 jsSHA.charSize = 8; // Number of Bits Per character (8 for ASCII, 16 for Unicode)
 jsSHA.b64pad  = ""; // base-64 pad character. "=" for strict RFC compliance
 jsSHA.hexCase = 0; // hex output format. 0 - lowercase; 1 - uppercase

 var sha1 = null;
 var sha224 = null;

The function it is calling (inside of the jsSHA function) (snippet)

 this.getHMAC = function (key, inputFormat, variant, outputFormat) {
  var formatFunc = null;
  var keyToUse = null;
  var blockByteSize = null;
  var blockBitSize = null;
  var keyWithIPad = [];
  var keyWithOPad = [];
  var lastArrayIndex = null;
  var retVal = null;
  var keyBinLen = null;
  var hashBitSize = null;

  // Validate the output format selection
  switch (outputFormat) {
  case "HEX":
   formatFunc = binb2hex;
   break;
  case "B64":
   formatFunc = binb2b64;
   break;
  default:
   return "FORMAT NOT RECOGNIZED";
  }

© Stack Overflow or respective owner

Related posts about JavaScript