Skip to content

Commit

Permalink
Add new shortcut methos which I find more readable.
Browse files Browse the repository at this point in the history
  • Loading branch information
lapo-luchini committed Nov 14, 2022
1 parent 1fb6f67 commit 1c16cff
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions asn1.js
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,9 @@ Stream.prototype.parseOID = function (start, end, maxLength, isRelative) {
}
return s;
};
Stream.prototype.parseRelativeOID = function (start, end, maxLength) {
return this.parseOID(start, end, maxLength, true);
};

function ASN1(stream, header, length, tag, tagLen, sub) {
if (!(tag instanceof ASN1Tag)) throw 'Invalid tag value.';
Expand Down Expand Up @@ -414,15 +417,15 @@ ASN1.prototype.content = function (maxLength) {
return "(" + d.size + " byte)\n" + d.str;
//case 0x05: // NULL
case 0x06: // OBJECT_IDENTIFIER
return this.stream.parseOID(content, content + len, maxLength, false);
return this.stream.parseOID(content, content + len, maxLength);
//case 0x07: // ObjectDescriptor
//case 0x08: // EXTERNAL
//case 0x09: // REAL
case 0x0A: // ENUMERATED
return this.stream.parseInteger(content, content + len);
//case 0x0B: // EMBEDDED_PDV
case 0x0D: // RELATIVE-OID
return this.stream.parseOID(content, content + len, maxLength, true);
return this.stream.parseRelativeOID(content, content + len, maxLength);
case 0x10: // SEQUENCE
case 0x11: // SET
if (this.sub !== null)
Expand Down

0 comments on commit 1c16cff

Please sign in to comment.