@wildboar/pkcs
Version:
Public Key Cryptography Standard PDUs in TypeScript
155 lines • 5.6 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports._encode_CRLBag = exports._decode_CRLBag = exports._extension_additions_list_spec_for_CRLBag = exports._root_component_type_list_2_spec_for_CRLBag = exports._root_component_type_list_1_spec_for_CRLBag = exports.CRLBag = exports.CRLTypes = void 0;
/* eslint-disable */
const asn1_ts_1 = require("asn1-ts");
const $ = require("asn1-ts/dist/node/functional");
var CRLTypes_osa_1 = require("../PKCS-12/CRLTypes.osa");
Object.defineProperty(exports, "CRLTypes", { enumerable: true, get: function () { return CRLTypes_osa_1.CRLTypes; } });
/* START_OF_SYMBOL_DEFINITION CRLBag */
/**
* @summary CRLBag
* @description
*
* ### ASN.1 Definition:
*
* ```asn1
* CRLBag ::= SEQUENCE {
* crlId BAG-TYPE.&id ({CRLTypes}),
* crltValue [0] EXPLICIT BAG-TYPE.&Type ({CRLTypes}{@crlId})
* }
* ```
*
* @class
*/
class CRLBag {
constructor(
/**
* @summary `crlId`.
* @public
* @readonly
*/
crlId,
/**
* @summary `crltValue`.
* @public
* @readonly
*/
crltValue) {
this.crlId = crlId;
this.crltValue = crltValue;
}
/**
* @summary Restructures an object into a CRLBag
* @description
*
* This takes an `object` and converts it to a `CRLBag`.
*
* @public
* @static
* @method
* @param {Object} _o An object having all of the keys and values of a `CRLBag`.
* @returns {CRLBag}
*/
static _from_object(_o) {
return new CRLBag(_o.crlId, _o.crltValue);
}
}
exports.CRLBag = CRLBag;
/* END_OF_SYMBOL_DEFINITION CRLBag */
/* START_OF_SYMBOL_DEFINITION _root_component_type_list_1_spec_for_CRLBag */
/**
* @summary The Leading Root Component Types of CRLBag
* @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_CRLBag = [
new $.ComponentSpec("crlId", false, $.hasTag(asn1_ts_1.ASN1TagClass.universal, 6), undefined, undefined),
new $.ComponentSpec("crltValue", false, $.hasTag(asn1_ts_1.ASN1TagClass.context, 0), undefined, undefined),
];
/* END_OF_SYMBOL_DEFINITION _root_component_type_list_1_spec_for_CRLBag */
/* START_OF_SYMBOL_DEFINITION _root_component_type_list_2_spec_for_CRLBag */
/**
* @summary The Trailing Root Component Types of CRLBag
* @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_CRLBag = [];
/* END_OF_SYMBOL_DEFINITION _root_component_type_list_2_spec_for_CRLBag */
/* START_OF_SYMBOL_DEFINITION _extension_additions_list_spec_for_CRLBag */
/**
* @summary The Extension Addition Component Types of CRLBag
* @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_CRLBag = [];
/* END_OF_SYMBOL_DEFINITION _extension_additions_list_spec_for_CRLBag */
/* START_OF_SYMBOL_DEFINITION _cached_decoder_for_CRLBag */
let _cached_decoder_for_CRLBag = null;
/* END_OF_SYMBOL_DEFINITION _cached_decoder_for_CRLBag */
/* START_OF_SYMBOL_DEFINITION _decode_CRLBag */
/**
* @summary Decodes an ASN.1 element into a(n) CRLBag
* @function
* @param {_Element} el The element being decoded.
* @returns {CRLBag} The decoded data structure.
*/
function _decode_CRLBag(el) {
if (!_cached_decoder_for_CRLBag) {
_cached_decoder_for_CRLBag = function (el) {
const sequence = el.sequence;
if (sequence.length < 2) {
throw new asn1_ts_1.ASN1ConstructionError("CRLBag contained only " +
sequence.length.toString() +
" elements.");
}
sequence[0].name = "crlId";
sequence[1].name = "crltValue";
let crlId;
let crltValue;
crlId = $._decodeObjectIdentifier(sequence[0]);
crltValue = $._decode_explicit(() => $._decodeAny)(sequence[1]);
return new CRLBag(crlId, crltValue);
};
}
return _cached_decoder_for_CRLBag(el);
}
exports._decode_CRLBag = _decode_CRLBag;
/* END_OF_SYMBOL_DEFINITION _decode_CRLBag */
/* START_OF_SYMBOL_DEFINITION _cached_encoder_for_CRLBag */
let _cached_encoder_for_CRLBag = null;
/* END_OF_SYMBOL_DEFINITION _cached_encoder_for_CRLBag */
/* START_OF_SYMBOL_DEFINITION _encode_CRLBag */
/**
* @summary Encodes a(n) CRLBag 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 CRLBag, encoded as an ASN.1 Element.
*/
function _encode_CRLBag(value, elGetter) {
if (!_cached_encoder_for_CRLBag) {
_cached_encoder_for_CRLBag = function (value, elGetter) {
return $._encodeSequence([]
.concat([
/* REQUIRED */ $._encodeObjectIdentifier(value.crlId, $.BER),
/* REQUIRED */ $._encode_explicit(asn1_ts_1.ASN1TagClass.context, 0, () => $._encodeAny, $.BER)(value.crltValue, $.BER),
])
.filter((c) => !!c), $.BER);
};
}
return _cached_encoder_for_CRLBag(value, elGetter);
}
exports._encode_CRLBag = _encode_CRLBag;
/* END_OF_SYMBOL_DEFINITION _encode_CRLBag */
/* eslint-enable */
//# sourceMappingURL=CRLBag.ta.js.map