UNPKG

@wildboar/pkcs

Version:
154 lines 6.94 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports._encode_X9_68CertificateAttributes = exports._decode_X9_68CertificateAttributes = exports._extension_additions_list_spec_for_X9_68CertificateAttributes = exports._root_component_type_list_2_spec_for_X9_68CertificateAttributes = exports._root_component_type_list_1_spec_for_X9_68CertificateAttributes = exports.X9_68CertificateAttributes = exports._get_encoder_for_ObjectValue = exports._get_decoder_for_ObjectValue = void 0; /* eslint-disable */ const asn1_ts_1 = require("asn1-ts"); const $ = require("asn1-ts/dist/node/functional"); const ObjectValue_ta_1 = require("../PKCS-15/ObjectValue.ta"); var ObjectValue_ta_2 = require("../PKCS-15/ObjectValue.ta"); Object.defineProperty(exports, "_get_decoder_for_ObjectValue", { enumerable: true, get: function () { return ObjectValue_ta_2._get_decoder_for_ObjectValue; } }); Object.defineProperty(exports, "_get_encoder_for_ObjectValue", { enumerable: true, get: function () { return ObjectValue_ta_2._get_encoder_for_ObjectValue; } }); /* START_OF_SYMBOL_DEFINITION X9_68CertificateAttributes */ /** * @summary X9_68CertificateAttributes * @description * * ### ASN.1 Definition: * * ```asn1 * X9-68CertificateAttributes ::= SEQUENCE { * value ObjectValue { PKCS15-OPAQUE.&Type }, * ... -- For future extensions * } * ``` * * @class */ class X9_68CertificateAttributes { constructor( /** * @summary `value`. * @public * @readonly */ value, /** * @summary Extensions that are not recognized. * @public * @readonly */ _unrecognizedExtensionsList = []) { this.value = value; this._unrecognizedExtensionsList = _unrecognizedExtensionsList; } /** * @summary Restructures an object into a X9_68CertificateAttributes * @description * * This takes an `object` and converts it to a `X9_68CertificateAttributes`. * * @public * @static * @method * @param {Object} _o An object having all of the keys and values of a `X9_68CertificateAttributes`. * @returns {X9_68CertificateAttributes} */ static _from_object(_o) { return new X9_68CertificateAttributes(_o.value, _o._unrecognizedExtensionsList); } } exports.X9_68CertificateAttributes = X9_68CertificateAttributes; /* END_OF_SYMBOL_DEFINITION X9_68CertificateAttributes */ /* START_OF_SYMBOL_DEFINITION _root_component_type_list_1_spec_for_X9_68CertificateAttributes */ /** * @summary The Leading Root Component Types of X9_68CertificateAttributes * @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_X9_68CertificateAttributes = [ new $.ComponentSpec("value", false, $.hasAnyTag, undefined, undefined), ]; /* END_OF_SYMBOL_DEFINITION _root_component_type_list_1_spec_for_X9_68CertificateAttributes */ /* START_OF_SYMBOL_DEFINITION _root_component_type_list_2_spec_for_X9_68CertificateAttributes */ /** * @summary The Trailing Root Component Types of X9_68CertificateAttributes * @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_X9_68CertificateAttributes = []; /* END_OF_SYMBOL_DEFINITION _root_component_type_list_2_spec_for_X9_68CertificateAttributes */ /* START_OF_SYMBOL_DEFINITION _extension_additions_list_spec_for_X9_68CertificateAttributes */ /** * @summary The Extension Addition Component Types of X9_68CertificateAttributes * @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_X9_68CertificateAttributes = []; /* END_OF_SYMBOL_DEFINITION _extension_additions_list_spec_for_X9_68CertificateAttributes */ /* START_OF_SYMBOL_DEFINITION _cached_decoder_for_X9_68CertificateAttributes */ let _cached_decoder_for_X9_68CertificateAttributes = null; /* END_OF_SYMBOL_DEFINITION _cached_decoder_for_X9_68CertificateAttributes */ /* START_OF_SYMBOL_DEFINITION _decode_X9_68CertificateAttributes */ /** * @summary Decodes an ASN.1 element into a(n) X9_68CertificateAttributes * @function * @param {_Element} el The element being decoded. * @returns {X9_68CertificateAttributes} The decoded data structure. */ function _decode_X9_68CertificateAttributes(el) { if (!_cached_decoder_for_X9_68CertificateAttributes) { _cached_decoder_for_X9_68CertificateAttributes = function (el) { const sequence = el.sequence; if (sequence.length < 1) { throw new asn1_ts_1.ASN1ConstructionError("X9-68CertificateAttributes contained only " + sequence.length.toString() + " elements."); } sequence[0].name = "value"; let value; value = ObjectValue_ta_1._get_decoder_for_ObjectValue($._decodeAny)(sequence[0]); return new X9_68CertificateAttributes(value, sequence.slice(1)); }; } return _cached_decoder_for_X9_68CertificateAttributes(el); } exports._decode_X9_68CertificateAttributes = _decode_X9_68CertificateAttributes; /* END_OF_SYMBOL_DEFINITION _decode_X9_68CertificateAttributes */ /* START_OF_SYMBOL_DEFINITION _cached_encoder_for_X9_68CertificateAttributes */ let _cached_encoder_for_X9_68CertificateAttributes = null; /* END_OF_SYMBOL_DEFINITION _cached_encoder_for_X9_68CertificateAttributes */ /* START_OF_SYMBOL_DEFINITION _encode_X9_68CertificateAttributes */ /** * @summary Encodes a(n) X9_68CertificateAttributes 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 X9_68CertificateAttributes, encoded as an ASN.1 Element. */ function _encode_X9_68CertificateAttributes(value, elGetter) { if (!_cached_encoder_for_X9_68CertificateAttributes) { _cached_encoder_for_X9_68CertificateAttributes = function (value, elGetter) { return $._encodeSequence([] .concat([ /* REQUIRED */ ObjectValue_ta_1._get_encoder_for_ObjectValue($._encodeAny)(value.value, $.BER), ], value._unrecognizedExtensionsList ? value._unrecognizedExtensionsList : []) .filter((c) => !!c), $.BER); }; } return _cached_encoder_for_X9_68CertificateAttributes(value, elGetter); } exports._encode_X9_68CertificateAttributes = _encode_X9_68CertificateAttributes; /* END_OF_SYMBOL_DEFINITION _encode_X9_68CertificateAttributes */ /* eslint-enable */ //# sourceMappingURL=X9-68CertificateAttributes.ta.js.map