UNPKG

pkcs-ts

Version:

PKCS #1 through #15 (Except #11) - Private and Public Keys, Certificates, and More

72 lines 3.71 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports._encode_OOBCertHash = exports._decode_OOBCertHash = exports._extension_additions_list_spec_for_OOBCertHash = exports._root_component_type_list_2_spec_for_OOBCertHash = exports._root_component_type_list_1_spec_for_OOBCertHash = exports.OOBCertHash = void 0; const tslib_1 = require("tslib"); const asn1_ts_1 = require("asn1-ts"); const $ = tslib_1.__importStar(require("asn1-ts/dist/node/functional")); const AlgorithmIdentifier_ta_1 = require("x500-ts/dist/node/modules/AuthenticationFramework/AlgorithmIdentifier.ta"); const CertId_ta_1 = require("../PKIXCRMF-2009/CertId.ta"); class OOBCertHash { constructor(hashAlg, certId, hashVal) { this.hashAlg = hashAlg; this.certId = certId; this.hashVal = hashVal; } static _from_object(_o) { return new OOBCertHash(_o.hashAlg, _o.certId, _o.hashVal); } } exports.OOBCertHash = OOBCertHash; exports._root_component_type_list_1_spec_for_OOBCertHash = [ new $.ComponentSpec("hashAlg", true, $.hasTag(asn1_ts_1.ASN1TagClass.context, 0), undefined, undefined), new $.ComponentSpec("certId", true, $.hasTag(asn1_ts_1.ASN1TagClass.universal, 16), undefined, undefined), new $.ComponentSpec("hashVal", false, $.hasTag(asn1_ts_1.ASN1TagClass.universal, 3), undefined, undefined), ]; exports._root_component_type_list_2_spec_for_OOBCertHash = []; exports._extension_additions_list_spec_for_OOBCertHash = []; let _cached_decoder_for_OOBCertHash = null; function _decode_OOBCertHash(el) { if (!_cached_decoder_for_OOBCertHash) { _cached_decoder_for_OOBCertHash = function (el) { let hashAlg; let certId; let hashVal; const callbacks = { hashAlg: (_el) => { hashAlg = $._decode_explicit(() => AlgorithmIdentifier_ta_1._decode_AlgorithmIdentifier)(_el); }, certId: (_el) => { certId = $._decode_explicit(() => CertId_ta_1._decode_CertId)(_el); }, hashVal: (_el) => { hashVal = $._decodeBitString(_el); }, }; $._parse_sequence(el, callbacks, exports._root_component_type_list_1_spec_for_OOBCertHash, exports._extension_additions_list_spec_for_OOBCertHash, exports._root_component_type_list_2_spec_for_OOBCertHash, undefined); return new OOBCertHash(hashAlg, certId, hashVal); }; } return _cached_decoder_for_OOBCertHash(el); } exports._decode_OOBCertHash = _decode_OOBCertHash; let _cached_encoder_for_OOBCertHash = null; function _encode_OOBCertHash(value, elGetter) { if (!_cached_encoder_for_OOBCertHash) { _cached_encoder_for_OOBCertHash = function (value, elGetter) { return $._encodeSequence([] .concat([ value.hashAlg === undefined ? undefined : $._encode_explicit(asn1_ts_1.ASN1TagClass.context, 0, () => AlgorithmIdentifier_ta_1._encode_AlgorithmIdentifier, $.BER)(value.hashAlg, $.BER), value.certId === undefined ? undefined : $._encode_explicit(asn1_ts_1.ASN1TagClass.context, 1, () => CertId_ta_1._encode_CertId, $.BER)(value.certId, $.BER), $._encodeBitString(value.hashVal, $.BER), ]) .filter((c) => !!c), $.BER); }; } return _cached_encoder_for_OOBCertHash(value, elGetter); } exports._encode_OOBCertHash = _encode_OOBCertHash; //# sourceMappingURL=OOBCertHash.ta.js.map