@wildboar/pki-stub
Version:
X.510 PKI-Stub ASN.1 data structures in TypeScript
200 lines • 8.43 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports._encode_AttCertIssuer = exports._decode_AttCertIssuer = exports._extension_additions_list_spec_for_AttCertIssuer = exports._root_component_type_list_2_spec_for_AttCertIssuer = exports._root_component_type_list_1_spec_for_AttCertIssuer = exports.AttCertIssuer = void 0;
/* eslint-disable */
const asn1_ts_1 = require("asn1-ts");
const $ = require("asn1-ts/dist/node/functional");
const GeneralNames_ta_1 = require("../PKI-Stub/GeneralNames.ta");
const IssuerSerial_ta_1 = require("../PKI-Stub/IssuerSerial.ta");
const ObjectDigestInfo_ta_1 = require("../PKI-Stub/ObjectDigestInfo.ta");
/* START_OF_SYMBOL_DEFINITION AttCertIssuer */
/**
* @summary AttCertIssuer
* @description
*
* ### ASN.1 Definition:
*
* ```asn1
* AttCertIssuer ::= [0] SEQUENCE {
* issuerName GeneralNames OPTIONAL,
* baseCertificateID [0] IssuerSerial OPTIONAL,
* objectDigestInfo [1] ObjectDigestInfo OPTIONAL,
* ... }
* (WITH COMPONENTS {..., issuerName PRESENT } |
* WITH COMPONENTS {..., baseCertificateID PRESENT } |
* WITH COMPONENTS {..., objectDigestInfo PRESENT } )
* ```
*
* @class
*/
class AttCertIssuer {
constructor(
/**
* @summary `issuerName`.
* @public
* @readonly
*/
issuerName,
/**
* @summary `baseCertificateID`.
* @public
* @readonly
*/
baseCertificateID,
/**
* @summary `objectDigestInfo`.
* @public
* @readonly
*/
objectDigestInfo,
/**
* @summary Extensions that are not recognized.
* @public
* @readonly
*/
_unrecognizedExtensionsList = []) {
this.issuerName = issuerName;
this.baseCertificateID = baseCertificateID;
this.objectDigestInfo = objectDigestInfo;
this._unrecognizedExtensionsList = _unrecognizedExtensionsList;
}
/**
* @summary Restructures an object into a AttCertIssuer
* @description
*
* This takes an `object` and converts it to a `AttCertIssuer`.
*
* @public
* @static
* @method
* @param {Object} _o An object having all of the keys and values of a `AttCertIssuer`.
* @returns {AttCertIssuer}
*/
static _from_object(_o) {
return new AttCertIssuer(_o.issuerName, _o.baseCertificateID, _o.objectDigestInfo, _o._unrecognizedExtensionsList);
}
}
exports.AttCertIssuer = AttCertIssuer;
/* END_OF_SYMBOL_DEFINITION AttCertIssuer */
/* START_OF_SYMBOL_DEFINITION _root_component_type_list_1_spec_for_AttCertIssuer */
/**
* @summary The Leading Root Component Types of AttCertIssuer
* @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_AttCertIssuer = [
new $.ComponentSpec("issuerName", true, $.hasTag(asn1_ts_1.ASN1TagClass.universal, 16), undefined, undefined),
new $.ComponentSpec("baseCertificateID", true, $.hasTag(asn1_ts_1.ASN1TagClass.context, 0), undefined, undefined),
new $.ComponentSpec("objectDigestInfo", true, $.hasTag(asn1_ts_1.ASN1TagClass.context, 1), undefined, undefined),
];
/* END_OF_SYMBOL_DEFINITION _root_component_type_list_1_spec_for_AttCertIssuer */
/* START_OF_SYMBOL_DEFINITION _root_component_type_list_2_spec_for_AttCertIssuer */
/**
* @summary The Trailing Root Component Types of AttCertIssuer
* @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_AttCertIssuer = [];
/* END_OF_SYMBOL_DEFINITION _root_component_type_list_2_spec_for_AttCertIssuer */
/* START_OF_SYMBOL_DEFINITION _extension_additions_list_spec_for_AttCertIssuer */
/**
* @summary The Extension Addition Component Types of AttCertIssuer
* @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_AttCertIssuer = [];
/* END_OF_SYMBOL_DEFINITION _extension_additions_list_spec_for_AttCertIssuer */
/* START_OF_SYMBOL_DEFINITION _cached_decoder_for_AttCertIssuer */
let _cached_decoder_for_AttCertIssuer = null;
/* END_OF_SYMBOL_DEFINITION _cached_decoder_for_AttCertIssuer */
/* START_OF_SYMBOL_DEFINITION _decode_AttCertIssuer */
/**
* @summary Decodes an ASN.1 element into a(n) AttCertIssuer
* @function
* @param {_Element} el The element being decoded.
* @returns {AttCertIssuer} The decoded data structure.
*/
function _decode_AttCertIssuer(el) {
if (!_cached_decoder_for_AttCertIssuer) {
_cached_decoder_for_AttCertIssuer = $._decode_implicit(() => function (el) {
/* START_OF_SEQUENCE_COMPONENT_DECLARATIONS */
let issuerName;
let baseCertificateID;
let objectDigestInfo;
let _unrecognizedExtensionsList = [];
/* END_OF_SEQUENCE_COMPONENT_DECLARATIONS */
/* START_OF_CALLBACKS_MAP */
const callbacks = {
issuerName: (_el) => {
issuerName = GeneralNames_ta_1._decode_GeneralNames(_el);
},
baseCertificateID: (_el) => {
baseCertificateID =
$._decode_implicit(() => IssuerSerial_ta_1._decode_IssuerSerial)(_el);
},
objectDigestInfo: (_el) => {
objectDigestInfo =
$._decode_implicit(() => ObjectDigestInfo_ta_1._decode_ObjectDigestInfo)(_el);
},
};
/* END_OF_CALLBACKS_MAP */
$._parse_sequence(el, callbacks, exports._root_component_type_list_1_spec_for_AttCertIssuer, exports._extension_additions_list_spec_for_AttCertIssuer, exports._root_component_type_list_2_spec_for_AttCertIssuer, (ext) => {
_unrecognizedExtensionsList.push(ext);
});
return new AttCertIssuer(
/* SEQUENCE_CONSTRUCTOR_CALL */ issuerName, baseCertificateID, objectDigestInfo, _unrecognizedExtensionsList);
});
}
return _cached_decoder_for_AttCertIssuer(el);
}
exports._decode_AttCertIssuer = _decode_AttCertIssuer;
/* END_OF_SYMBOL_DEFINITION _decode_AttCertIssuer */
/* START_OF_SYMBOL_DEFINITION _cached_encoder_for_AttCertIssuer */
let _cached_encoder_for_AttCertIssuer = null;
/* END_OF_SYMBOL_DEFINITION _cached_encoder_for_AttCertIssuer */
/* START_OF_SYMBOL_DEFINITION _encode_AttCertIssuer */
/**
* @summary Encodes a(n) AttCertIssuer 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 AttCertIssuer, encoded as an ASN.1 Element.
*/
function _encode_AttCertIssuer(value, elGetter) {
if (!_cached_encoder_for_AttCertIssuer) {
_cached_encoder_for_AttCertIssuer = $._encode_implicit(asn1_ts_1.ASN1TagClass.context, 0, () => function (value, elGetter) {
return $._encodeSequence([]
.concat([
/* IF_ABSENT */ value.issuerName ===
undefined
? undefined
: GeneralNames_ta_1._encode_GeneralNames(value.issuerName, $.BER),
/* IF_ABSENT */ value.baseCertificateID ===
undefined
? undefined
: $._encode_implicit(asn1_ts_1.ASN1TagClass.context, 0, () => IssuerSerial_ta_1._encode_IssuerSerial, $.BER)(value.baseCertificateID, $.BER),
/* IF_ABSENT */ value.objectDigestInfo ===
undefined
? undefined
: $._encode_implicit(asn1_ts_1.ASN1TagClass.context, 1, () => ObjectDigestInfo_ta_1._encode_ObjectDigestInfo, $.BER)(value.objectDigestInfo, $.BER),
], value._unrecognizedExtensionsList
? value._unrecognizedExtensionsList
: [])
.filter((c) => !!c), $.BER);
}, $.BER);
}
return _cached_encoder_for_AttCertIssuer(value, elGetter);
}
exports._encode_AttCertIssuer = _encode_AttCertIssuer;
/* END_OF_SYMBOL_DEFINITION _encode_AttCertIssuer */
/* eslint-enable */
//# sourceMappingURL=AttCertIssuer.ta.js.map