Server IP : 66.29.132.122 / Your IP : 3.138.134.140 Web Server : LiteSpeed System : Linux business142.web-hosting.com 4.18.0-553.lve.el8.x86_64 #1 SMP Mon May 27 15:27:34 UTC 2024 x86_64 User : admazpex ( 531) PHP Version : 7.2.34 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /proc/self/root/proc/self/root/proc/thread-self/root/opt/alt/alt-nodejs19/root/lib/node_modules/npm/node_modules.bundled/sigstore/dist/x509/asn1/ |
Upload File : |
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.dump = void 0; const tag_1 = require("./tag"); // Utility function to dump the contents of an ASN1Obj to the console. function dump(obj, indent = 0) { let str = ' '.repeat(indent); str += tagToString(obj.tag) + ' '; if (obj.tag.isUniversal()) { switch (obj.tag.number) { case tag_1.UNIVERSAL_TAG.BOOLEAN: str += obj.toBoolean(); break; case tag_1.UNIVERSAL_TAG.INTEGER: str += `(${obj.value.length} byte) `; str += obj.toInteger(); break; case tag_1.UNIVERSAL_TAG.BIT_STRING: { const bits = obj.toBitString(); str += `(${bits.length} bit) `; str += truncate(bits.map((bit) => bit.toString()).join('')); break; } case tag_1.UNIVERSAL_TAG.OBJECT_IDENTIFIER: str += obj.toOID(); break; case tag_1.UNIVERSAL_TAG.SEQUENCE: case tag_1.UNIVERSAL_TAG.SET: str += `(${obj.subs.length} elem) `; break; case tag_1.UNIVERSAL_TAG.PRINTABLE_STRING: str += obj.value.toString('ascii'); break; case tag_1.UNIVERSAL_TAG.UTC_TIME: case tag_1.UNIVERSAL_TAG.GENERALIZED_TIME: str += obj.toDate().toUTCString(); break; default: str += `(${obj.value.length} byte) `; str += isASCII(obj.value) ? obj.value.toString('ascii') : truncate(obj.value.toString('hex').toUpperCase()); } } else { if (obj.tag.constructed) { str += `(${obj.subs.length} elem) `; } else { str += `(${obj.value.length} byte) `; str += isASCII(obj.value) ? obj.value.toString('ascii') : obj.value.toString('hex').toUpperCase(); } } console.log(str); // Recursive call for children obj.subs.forEach((sub) => dump(sub, indent + 2)); } exports.dump = dump; function tagToString(tag) { if (tag.isContextSpecific()) { return `[${tag.number.toString(16)}]`; } else { switch (tag.number) { case tag_1.UNIVERSAL_TAG.BOOLEAN: return 'BOOLEAN'; case tag_1.UNIVERSAL_TAG.INTEGER: return 'INTEGER'; case tag_1.UNIVERSAL_TAG.BIT_STRING: return 'BIT STRING'; case tag_1.UNIVERSAL_TAG.OCTET_STRING: return 'OCTET STRING'; case tag_1.UNIVERSAL_TAG.OBJECT_IDENTIFIER: return 'OBJECT IDENTIFIER'; case tag_1.UNIVERSAL_TAG.SEQUENCE: return 'SEQUENCE'; case tag_1.UNIVERSAL_TAG.SET: return 'SET'; case tag_1.UNIVERSAL_TAG.PRINTABLE_STRING: return 'PrintableString'; case tag_1.UNIVERSAL_TAG.UTC_TIME: return 'UTCTime'; case tag_1.UNIVERSAL_TAG.GENERALIZED_TIME: return 'GeneralizedTime'; default: return tag.number.toString(16); } } } function isASCII(buf) { return buf.every((b) => b >= 32 && b <= 126); } function truncate(str) { return str.length > 70 ? str.substring(0, 69) + '...' : str; }