UNPKG

@peculiar/fortify-client-core

Version:

Fortify client core API for quickly connect to Fortify App

41 lines (40 loc) 1.63 kB
"use strict"; /** * @license * Copyright (c) Peculiar Ventures, LLC. * * This source code is licensed under the BSD 3-Clause license found in the * LICENSE file in the root directory of this source tree. */ Object.defineProperty(exports, "__esModule", { value: true }); exports.Extension = void 0; const asn1_x509_1 = require("@peculiar/asn1-x509"); const asn1_x509_qualified_1 = require("@peculiar/asn1-x509-qualified"); const asn1_schema_1 = require("@peculiar/asn1-schema"); const asn_data_1 = require("./asn_data"); class Extension extends asn_data_1.AsnData { constructor(raw) { super(raw, asn1_x509_1.Extension); const asnExtnValue = this.getAsnExtnValue(); switch (this.asn.extnID) { case asn1_x509_1.id_ce_keyUsage: this.value = asn1_schema_1.AsnParser.parse(asnExtnValue, asn1_x509_1.KeyUsage); break; case asn1_x509_1.id_ce_certificatePolicies: this.value = asn1_schema_1.AsnParser.parse(asnExtnValue, asn1_x509_1.CertificatePolicies); break; case asn1_x509_qualified_1.id_pe_qcStatements: this.value = asn1_schema_1.AsnParser.parse(asnExtnValue, asn1_x509_qualified_1.QCStatements); break; case asn1_x509_1.id_ce_basicConstraints: this.value = asn1_schema_1.AsnParser.parse(asnExtnValue, asn1_x509_1.BasicConstraints); break; default: this.value = asnExtnValue; } } getAsnExtnValue() { return this.asn.extnValue.buffer; } } exports.Extension = Extension;