UNPKG

@wildboar/pkcs

Version:
169 lines 7.73 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports._encode_OriginatorInfo = exports._decode_OriginatorInfo = exports._extension_additions_list_spec_for_OriginatorInfo = exports._root_component_type_list_2_spec_for_OriginatorInfo = exports._root_component_type_list_1_spec_for_OriginatorInfo = exports.OriginatorInfo = exports._encode_CertificateSet = exports._decode_CertificateSet = exports._encode_CertificateRevocationLists = exports._decode_CertificateRevocationLists = void 0; /* eslint-disable */ const asn1_ts_1 = require("asn1-ts"); const $ = require("asn1-ts/dist/node/functional"); const CertificateRevocationLists_ta_1 = require("../CryptographicMessageSyntax/CertificateRevocationLists.ta"); const CertificateSet_ta_1 = require("../CryptographicMessageSyntax/CertificateSet.ta"); var CertificateRevocationLists_ta_2 = require("../CryptographicMessageSyntax/CertificateRevocationLists.ta"); Object.defineProperty(exports, "_decode_CertificateRevocationLists", { enumerable: true, get: function () { return CertificateRevocationLists_ta_2._decode_CertificateRevocationLists; } }); Object.defineProperty(exports, "_encode_CertificateRevocationLists", { enumerable: true, get: function () { return CertificateRevocationLists_ta_2._encode_CertificateRevocationLists; } }); var CertificateSet_ta_2 = require("../CryptographicMessageSyntax/CertificateSet.ta"); Object.defineProperty(exports, "_decode_CertificateSet", { enumerable: true, get: function () { return CertificateSet_ta_2._decode_CertificateSet; } }); Object.defineProperty(exports, "_encode_CertificateSet", { enumerable: true, get: function () { return CertificateSet_ta_2._encode_CertificateSet; } }); /* START_OF_SYMBOL_DEFINITION OriginatorInfo */ /** * @summary OriginatorInfo * @description * * ### ASN.1 Definition: * * ```asn1 * OriginatorInfo ::= SEQUENCE { * certs [0] IMPLICIT CertificateSet OPTIONAL, * crls [1] IMPLICIT CertificateRevocationLists OPTIONAL * } * ``` * * @class */ class OriginatorInfo { constructor( /** * @summary `certs`. * @public * @readonly */ certs, /** * @summary `crls`. * @public * @readonly */ crls) { this.certs = certs; this.crls = crls; } /** * @summary Restructures an object into a OriginatorInfo * @description * * This takes an `object` and converts it to a `OriginatorInfo`. * * @public * @static * @method * @param {Object} _o An object having all of the keys and values of a `OriginatorInfo`. * @returns {OriginatorInfo} */ static _from_object(_o) { return new OriginatorInfo(_o.certs, _o.crls); } } exports.OriginatorInfo = OriginatorInfo; /* END_OF_SYMBOL_DEFINITION OriginatorInfo */ /* START_OF_SYMBOL_DEFINITION _root_component_type_list_1_spec_for_OriginatorInfo */ /** * @summary The Leading Root Component Types of OriginatorInfo * @description * * This is an array of `ComponentSpec`s that define how to decode the leading root component type list of a SET or SEQUENCE. * * @constant */ exports._root_component_type_list_1_spec_for_OriginatorInfo = [ new $.ComponentSpec("certs", true, $.hasTag(asn1_ts_1.ASN1TagClass.context, 0), undefined, undefined), new $.ComponentSpec("crls", true, $.hasTag(asn1_ts_1.ASN1TagClass.context, 1), undefined, undefined), ]; /* END_OF_SYMBOL_DEFINITION _root_component_type_list_1_spec_for_OriginatorInfo */ /* START_OF_SYMBOL_DEFINITION _root_component_type_list_2_spec_for_OriginatorInfo */ /** * @summary The Trailing Root Component Types of OriginatorInfo * @description * * This is an array of `ComponentSpec`s that define how to decode the trailing root component type list of a SET or SEQUENCE. * * @constant */ exports._root_component_type_list_2_spec_for_OriginatorInfo = []; /* END_OF_SYMBOL_DEFINITION _root_component_type_list_2_spec_for_OriginatorInfo */ /* START_OF_SYMBOL_DEFINITION _extension_additions_list_spec_for_OriginatorInfo */ /** * @summary The Extension Addition Component Types of OriginatorInfo * @description * * This is an array of `ComponentSpec`s that define how to decode the extension addition component type list of a SET or SEQUENCE. * * @constant */ exports._extension_additions_list_spec_for_OriginatorInfo = []; /* END_OF_SYMBOL_DEFINITION _extension_additions_list_spec_for_OriginatorInfo */ /* START_OF_SYMBOL_DEFINITION _cached_decoder_for_OriginatorInfo */ let _cached_decoder_for_OriginatorInfo = null; /* END_OF_SYMBOL_DEFINITION _cached_decoder_for_OriginatorInfo */ /* START_OF_SYMBOL_DEFINITION _decode_OriginatorInfo */ /** * @summary Decodes an ASN.1 element into a(n) OriginatorInfo * @function * @param {_Element} el The element being decoded. * @returns {OriginatorInfo} The decoded data structure. */ function _decode_OriginatorInfo(el) { if (!_cached_decoder_for_OriginatorInfo) { _cached_decoder_for_OriginatorInfo = function (el) { /* START_OF_SEQUENCE_COMPONENT_DECLARATIONS */ let certs; let crls; /* END_OF_SEQUENCE_COMPONENT_DECLARATIONS */ /* START_OF_CALLBACKS_MAP */ const callbacks = { certs: (_el) => { certs = $._decode_implicit(() => CertificateSet_ta_1._decode_CertificateSet)(_el); }, crls: (_el) => { crls = $._decode_implicit(() => CertificateRevocationLists_ta_1._decode_CertificateRevocationLists)(_el); }, }; /* END_OF_CALLBACKS_MAP */ $._parse_sequence(el, callbacks, exports._root_component_type_list_1_spec_for_OriginatorInfo, exports._extension_additions_list_spec_for_OriginatorInfo, exports._root_component_type_list_2_spec_for_OriginatorInfo, undefined); return new OriginatorInfo( /* SEQUENCE_CONSTRUCTOR_CALL */ certs, crls); }; } return _cached_decoder_for_OriginatorInfo(el); } exports._decode_OriginatorInfo = _decode_OriginatorInfo; /* END_OF_SYMBOL_DEFINITION _decode_OriginatorInfo */ /* START_OF_SYMBOL_DEFINITION _cached_encoder_for_OriginatorInfo */ let _cached_encoder_for_OriginatorInfo = null; /* END_OF_SYMBOL_DEFINITION _cached_encoder_for_OriginatorInfo */ /* START_OF_SYMBOL_DEFINITION _encode_OriginatorInfo */ /** * @summary Encodes a(n) OriginatorInfo into an ASN.1 Element. * @function * @param {value} el The element being decoded. * @param elGetter A function that can be used to get new ASN.1 elements. * @returns {_Element} The OriginatorInfo, encoded as an ASN.1 Element. */ function _encode_OriginatorInfo(value, elGetter) { if (!_cached_encoder_for_OriginatorInfo) { _cached_encoder_for_OriginatorInfo = function (value, elGetter) { return $._encodeSequence([] .concat([ /* IF_ABSENT */ value.certs === undefined ? undefined : $._encode_implicit(asn1_ts_1.ASN1TagClass.context, 0, () => CertificateSet_ta_1._encode_CertificateSet, $.BER)(value.certs, $.BER), /* IF_ABSENT */ value.crls === undefined ? undefined : $._encode_implicit(asn1_ts_1.ASN1TagClass.context, 1, () => CertificateRevocationLists_ta_1._encode_CertificateRevocationLists, $.BER)(value.crls, $.BER), ]) .filter((c) => !!c), $.BER); }; } return _cached_encoder_for_OriginatorInfo(value, elGetter); } exports._encode_OriginatorInfo = _encode_OriginatorInfo; /* END_OF_SYMBOL_DEFINITION _encode_OriginatorInfo */ /* eslint-enable */ //# sourceMappingURL=OriginatorInfo.ta.js.map