UNPKG

@indrajala/asn1der

Version:

parse ASN.1 DER structures

28 lines 1.23 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const chai_1 = require("chai"); require("mocha"); const asn1der_1 = require("../asn1der"); // import { authorizationListLookup } from '../model/google'; const google_1 = require("./data/pem/google"); describe('parseDER', () => { it('basic parsing of a valid X.509 cert should succeed, returning a single node', () => { chai_1.expect(asn1der_1.parseDER(asn1der_1.pemToDER(google_1.rsaTEE[3])).length) .to .equal(1); }); it('reparsing of an octet string node which is valid DER should increase its child count', () => { const node = asn1der_1.parseDER(asn1der_1.pemToDER(google_1.rsaTEE[0]))[0]; // SW enforced const extNode = node.get('0.7.0.1.1'); const childCountBefore = extNode.children.length; extNode.reparse(); const childCountAfter = extNode.children.length; //node.summary(4, authorizationListLookup()).forEach(it => console.log(it)); const childCountIncreased = childCountAfter > childCountBefore; chai_1.expect(childCountIncreased) .to .equal(true); }); }); //# sourceMappingURL=parseDER.spec.js.map