asn1-ts 7.0.8 → 7.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"decodeInteger.d.ts","sourceRoot":"","sources":["../../../../../source/codecs/x690/decoders/decodeInteger.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAG1C,MAAM,CAAC,OAAO,UACL,aAAa,CAAE,KAAK,EAAE,UAAU,GAAG,OAAO,CAclD"}
1
+ {"version":3,"file":"decodeInteger.d.ts","sourceRoot":"","sources":["../../../../../source/codecs/x690/decoders/decodeInteger.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAG1C,MAAM,CAAC,OAAO,UACL,aAAa,CAAE,KAAK,EAAE,UAAU,GAAG,OAAO,CAkBlD"}
@@ -5,12 +5,14 @@ const errors = tslib_1.__importStar(require("../../../errors"));
5
5
  const bigint_1 = require("../../../utils/bigint");
6
6
  function decodeInteger(value) {
7
7
  if (value.length === 0) {
8
- throw new errors.ASN1SizeError("INTEGER encoded on zero bytes!");
8
+ throw new errors.ASN1SizeError("INTEGER or ENUMERATED encoded on zero bytes");
9
9
  }
10
10
  if (value.length > 2
11
11
  && ((value[0] === 0xFF && value[1] >= 0b10000000)
12
12
  || (value[0] === 0x00 && value[1] < 0b10000000))) {
13
- throw new errors.ASN1PaddingError("Unnecessary padding bytes on INTEGER or ENUMERATED.");
13
+ const buf = Buffer.from(value.slice(0, 16));
14
+ throw new errors.ASN1PaddingError("Unnecessary padding bytes on INTEGER or ENUMERATED. "
15
+ + `First 16 bytes of the offending value were: 0x${buf.toString("hex")}`);
14
16
  }
15
17
  return (0, bigint_1.bufferToInteger)(value);
16
18
  }
@@ -1 +1 @@
1
- {"version":3,"file":"decodeInteger.js","sourceRoot":"","sources":["../../../../../source/codecs/x690/decoders/decodeInteger.ts"],"names":[],"mappings":";;;AAAA,gEAA0C;AAE1C,kDAAwD;AAExD,SACS,aAAa,CAAE,KAAiB;IACrC,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE;QACpB,MAAM,IAAI,MAAM,CAAC,aAAa,CAAC,gCAAgC,CAAC,CAAC;KACpE;IACD,IACI,KAAK,CAAC,MAAM,GAAG,CAAC;WACb,CACC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,IAAI,IAAI,KAAK,CAAC,CAAC,CAAC,IAAI,UAAU,CAAC;eAC1C,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,IAAI,IAAI,KAAK,CAAC,CAAC,CAAC,GAAG,UAAU,CAAC,CAClD,EACH;QACE,MAAM,IAAI,MAAM,CAAC,gBAAgB,CAAC,qDAAqD,CAAC,CAAC;KAC5F;IACD,OAAO,IAAA,wBAAe,EAAC,KAAK,CAAC,CAAC;AAClC,CAAC;AAfD,gCAeC"}
1
+ {"version":3,"file":"decodeInteger.js","sourceRoot":"","sources":["../../../../../source/codecs/x690/decoders/decodeInteger.ts"],"names":[],"mappings":";;;AAAA,gEAA0C;AAE1C,kDAAwD;AAExD,SACS,aAAa,CAAE,KAAiB;IACrC,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE;QACpB,MAAM,IAAI,MAAM,CAAC,aAAa,CAAC,6CAA6C,CAAC,CAAC;KACjF;IACD,IACI,KAAK,CAAC,MAAM,GAAG,CAAC;WACb,CACC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,IAAI,IAAI,KAAK,CAAC,CAAC,CAAC,IAAI,UAAU,CAAC;eAC1C,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,IAAI,IAAI,KAAK,CAAC,CAAC,CAAC,GAAG,UAAU,CAAC,CAClD,EACH;QAEE,MAAM,GAAG,GAAG,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;QAC5C,MAAM,IAAI,MAAM,CAAC,gBAAgB,CAC7B,sDAAsD;cACpD,iDAAiD,GAAG,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;KACjF;IACD,OAAO,IAAA,wBAAe,EAAC,KAAK,CAAC,CAAC;AAClC,CAAC;AAnBD,gCAmBC"}
package/package.json CHANGED
@@ -61,5 +61,5 @@
61
61
  "test": "npx jest --ci --reporters=default --reporters=jest-junit --coverage"
62
62
  },
63
63
  "types": "./dist/node/index.d.ts",
64
- "version": "7.0.8"
64
+ "version": "7.0.9"
65
65
  }