From 1fb6f67f457c0eb63a8a8725dc1cce47d705fd3a Mon Sep 17 00:00:00 2001 From: Lapo Luchini Date: Mon, 14 Nov 2022 19:26:45 +0000 Subject: [PATCH] First value of relative OIDs is normal, does not encode two arcs. --- asn1.js | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/asn1.js b/asn1.js index ce362c5..a014754 100644 --- a/asn1.js +++ b/asn1.js @@ -290,7 +290,9 @@ Stream.prototype.parseOID = function (start, end, maxLength, isRelative) { if (!(v & 0x80)) { // finished if (s === '') { n = n.simplify(); - if (n instanceof Int10) { + if (isRelative) { + s = (n instanceof Int10) ? n.toString() : "" + n; + } else if (n instanceof Int10) { n.sub(80); s = "2." + n.toString(); } else { @@ -307,14 +309,7 @@ Stream.prototype.parseOID = function (start, end, maxLength, isRelative) { } if (bits > 0) s += ".incomplete"; - if (isRelative) { - if (s.length > 2) { - const prefix = s.slice(0, 2); - if ("0." == prefix) { - s = s.slice(2); - } - } - } else if (typeof oids === 'object') { + if (typeof oids === 'object' && !isRelative) { var oid = oids[s]; if (oid) { if (oid.d) s += "\n" + oid.d; -- 2.51.2