diff --git a/asn1.js b/asn1.js
index d44bae6..55c8f8c 100644
--- a/asn1.js
+++ b/asn1.js
@@ -17,6 +17,7 @@
"use strict";
var Int10 = (typeof module !== 'undefined') ? require('./int10.js') : window.Int10,
+ oids = (typeof module !== 'undefined') ? require('./oids.js') : window.oids,
ellipsis = "\u2026",
reTimeS = /^(\d\d)(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])([01]\d|2[0-3])(?:([0-5]\d)(?:([0-5]\d)(?:[.,](\d{1,3}))?)?)?(Z|[-+](?:[0]\d|1[0-2])([0-5]\d)?)?$/,
reTimeL = /^(\d\d\d\d)(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])([01]\d|2[0-3])(?:([0-5]\d)(?:([0-5]\d)(?:[.,](\d{1,3}))?)?)?(Z|[-+](?:[0]\d|1[0-2])([0-5]\d)?)?$/;
@@ -213,6 +214,14 @@ Stream.prototype.parseOID = function (start, end, maxLength) {
}
if (bits > 0)
s += ".incomplete";
+ if (typeof oids === 'object') {
+ var oid = oids[s];
+ if (oid) {
+ if (oid.d) s += "\n" + oid.d;
+ if (oid.c) s += "\n" + oid.c;
+ if (oid.w) s += "\n(warning!)";
+ }
+ }
return s;
};
@@ -332,6 +341,9 @@ ASN1.prototype.toPrettyString = function (indent) {
s += " (constructed)";
else if ((this.tag.isUniversal() && ((this.tag.tagNumber == 0x03) || (this.tag.tagNumber == 0x04))) && (this.sub !== null))
s += " (encapsulates)";
+ var content = this.content();
+ if (content)
+ s += ": " + content.replace(/\n/g, '|');
s += "\n";
if (this.sub !== null) {
indent += ' ';
diff --git a/dom.js b/dom.js
index d1c44c4..9b4eb1b 100644
--- a/dom.js
+++ b/dom.js
@@ -13,11 +13,11 @@
// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-/*global oids */
(function (undefined) {
"use strict";
var ASN1 = (typeof module !== 'undefined') ? require('./asn1.js') : window.ASN1,
+ oids = (typeof module !== 'undefined') ? require('./oids.js') : window.oids,
lineLength = 80,
contentLength = 8 * lineLength,
DOM = {
@@ -48,6 +48,7 @@ var ASN1 = (typeof module !== 'undefined') ? require('./asn1.js') : window.ASN1,
};
ASN1.prototype.toDOM = function () {
+ var isOID = (typeof oids === 'object') && (this.tag.isUniversal() && (this.tag.tagNumber == 0x06));
var node = DOM.tag("div", "node");
node.asn1 = this;
var head = DOM.tag("div", "head");
@@ -58,9 +59,11 @@ ASN1.prototype.toDOM = function () {
var preview = DOM.tag("span", "preview"),
shortContent;
content = String(content); // it might be a number
+ if (isOID)
+ content = content.split('\n', 1)[0];
shortContent = (content.length > lineLength) ? content.substring(0, lineLength) + DOM.ellipsis : content;
preview.appendChild(DOM.text(shortContent));
- if ((typeof oids === 'object') && (this.tag.isUniversal() && (this.tag.tagNumber == 0x06))) {
+ if (isOID) {
var oid = oids[content];
if (oid) {
if (oid.d) {
@@ -97,13 +100,10 @@ ASN1.prototype.toDOM = function () {
//TODO if (this.tag.isUniversal() && this.tag.tagNumber == 0x03) s += "Unused bits: "
if (content !== null) {
s += "
Value:
" + content + "";
- if ((typeof oids === 'object') && (this.tag.isUniversal() && (this.tag.tagNumber == 0x06))) {
- var oid = oids[content];
- if (oid) {
- if (oid.d) s += "
" + oid.d;
- if (oid.c) s += "
" + oid.c;
- if (oid.w) s += "
(warning!)";
- }
+ if (isOID && oid) {
+ if (oid.d) s += "
" + oid.d;
+ if (oid.c) s += "
" + oid.c;
+ if (oid.w) s += "
(warning!)";
}
}
value.innerHTML = s;