@wildboar/pkcs
Version:
Public Key Cryptography Standard PDUs in TypeScript
158 lines • 7.42 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports._encode_KeyManagementInfo_Item = exports._decode_KeyManagementInfo_Item = exports._extension_additions_list_spec_for_KeyManagementInfo_Item = exports._root_component_type_list_2_spec_for_KeyManagementInfo_Item = exports._root_component_type_list_1_spec_for_KeyManagementInfo_Item = exports.KeyManagementInfo_Item = exports._encode_KeyManagementInfo_Item_keyInfo = exports._decode_KeyManagementInfo_Item_keyInfo = exports._encode_Identifier = exports._decode_Identifier = void 0;
/* eslint-disable */
const asn1_ts_1 = require("asn1-ts");
const $ = require("asn1-ts/dist/node/functional");
const Identifier_ta_1 = require("../PKCS-15/Identifier.ta");
const KeyManagementInfo_Item_keyInfo_ta_1 = require("../PKCS-15/KeyManagementInfo-Item-keyInfo.ta");
var Identifier_ta_2 = require("../PKCS-15/Identifier.ta");
Object.defineProperty(exports, "_decode_Identifier", { enumerable: true, get: function () { return Identifier_ta_2._decode_Identifier; } });
Object.defineProperty(exports, "_encode_Identifier", { enumerable: true, get: function () { return Identifier_ta_2._encode_Identifier; } });
var KeyManagementInfo_Item_keyInfo_ta_2 = require("../PKCS-15/KeyManagementInfo-Item-keyInfo.ta");
Object.defineProperty(exports, "_decode_KeyManagementInfo_Item_keyInfo", { enumerable: true, get: function () { return KeyManagementInfo_Item_keyInfo_ta_2._decode_KeyManagementInfo_Item_keyInfo; } });
Object.defineProperty(exports, "_encode_KeyManagementInfo_Item_keyInfo", { enumerable: true, get: function () { return KeyManagementInfo_Item_keyInfo_ta_2._encode_KeyManagementInfo_Item_keyInfo; } });
/* START_OF_SYMBOL_DEFINITION KeyManagementInfo_Item */
/**
* @summary KeyManagementInfo_Item
* @description
*
* ### ASN.1 Definition:
*
* ```asn1
* KeyManagementInfo-Item ::= SEQUENCE { -- REMOVED_FROM_UNNESTING -- }
* ```
*
* @class
*/
class KeyManagementInfo_Item {
constructor(
/**
* @summary `keyId`.
* @public
* @readonly
*/
keyId,
/**
* @summary `keyInfo`.
* @public
* @readonly
*/
keyInfo) {
this.keyId = keyId;
this.keyInfo = keyInfo;
}
/**
* @summary Restructures an object into a KeyManagementInfo_Item
* @description
*
* This takes an `object` and converts it to a `KeyManagementInfo_Item`.
*
* @public
* @static
* @method
* @param {Object} _o An object having all of the keys and values of a `KeyManagementInfo_Item`.
* @returns {KeyManagementInfo_Item}
*/
static _from_object(_o) {
return new KeyManagementInfo_Item(_o.keyId, _o.keyInfo);
}
}
exports.KeyManagementInfo_Item = KeyManagementInfo_Item;
/* END_OF_SYMBOL_DEFINITION KeyManagementInfo_Item */
/* START_OF_SYMBOL_DEFINITION _root_component_type_list_1_spec_for_KeyManagementInfo_Item */
/**
* @summary The Leading Root Component Types of KeyManagementInfo_Item
* @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_KeyManagementInfo_Item = [
new $.ComponentSpec("keyId", false, $.hasTag(asn1_ts_1.ASN1TagClass.universal, 4), undefined, undefined),
new $.ComponentSpec("keyInfo", false, $.hasAnyTag, undefined, undefined),
];
/* END_OF_SYMBOL_DEFINITION _root_component_type_list_1_spec_for_KeyManagementInfo_Item */
/* START_OF_SYMBOL_DEFINITION _root_component_type_list_2_spec_for_KeyManagementInfo_Item */
/**
* @summary The Trailing Root Component Types of KeyManagementInfo_Item
* @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_KeyManagementInfo_Item = [];
/* END_OF_SYMBOL_DEFINITION _root_component_type_list_2_spec_for_KeyManagementInfo_Item */
/* START_OF_SYMBOL_DEFINITION _extension_additions_list_spec_for_KeyManagementInfo_Item */
/**
* @summary The Extension Addition Component Types of KeyManagementInfo_Item
* @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_KeyManagementInfo_Item = [];
/* END_OF_SYMBOL_DEFINITION _extension_additions_list_spec_for_KeyManagementInfo_Item */
/* START_OF_SYMBOL_DEFINITION _cached_decoder_for_KeyManagementInfo_Item */
let _cached_decoder_for_KeyManagementInfo_Item = null;
/* END_OF_SYMBOL_DEFINITION _cached_decoder_for_KeyManagementInfo_Item */
/* START_OF_SYMBOL_DEFINITION _decode_KeyManagementInfo_Item */
/**
* @summary Decodes an ASN.1 element into a(n) KeyManagementInfo_Item
* @function
* @param {_Element} el The element being decoded.
* @returns {KeyManagementInfo_Item} The decoded data structure.
*/
function _decode_KeyManagementInfo_Item(el) {
if (!_cached_decoder_for_KeyManagementInfo_Item) {
_cached_decoder_for_KeyManagementInfo_Item = function (el) {
const sequence = el.sequence;
if (sequence.length < 2) {
throw new asn1_ts_1.ASN1ConstructionError("KeyManagementInfo-Item contained only " +
sequence.length.toString() +
" elements.");
}
sequence[0].name = "keyId";
sequence[1].name = "keyInfo";
let keyId;
let keyInfo;
keyId = Identifier_ta_1._decode_Identifier(sequence[0]);
keyInfo = KeyManagementInfo_Item_keyInfo_ta_1._decode_KeyManagementInfo_Item_keyInfo(sequence[1]);
return new KeyManagementInfo_Item(keyId, keyInfo);
};
}
return _cached_decoder_for_KeyManagementInfo_Item(el);
}
exports._decode_KeyManagementInfo_Item = _decode_KeyManagementInfo_Item;
/* END_OF_SYMBOL_DEFINITION _decode_KeyManagementInfo_Item */
/* START_OF_SYMBOL_DEFINITION _cached_encoder_for_KeyManagementInfo_Item */
let _cached_encoder_for_KeyManagementInfo_Item = null;
/* END_OF_SYMBOL_DEFINITION _cached_encoder_for_KeyManagementInfo_Item */
/* START_OF_SYMBOL_DEFINITION _encode_KeyManagementInfo_Item */
/**
* @summary Encodes a(n) KeyManagementInfo_Item 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 KeyManagementInfo_Item, encoded as an ASN.1 Element.
*/
function _encode_KeyManagementInfo_Item(value, elGetter) {
if (!_cached_encoder_for_KeyManagementInfo_Item) {
_cached_encoder_for_KeyManagementInfo_Item = function (value, elGetter) {
return $._encodeSequence([]
.concat([
/* REQUIRED */ Identifier_ta_1._encode_Identifier(value.keyId, $.BER),
/* REQUIRED */ KeyManagementInfo_Item_keyInfo_ta_1._encode_KeyManagementInfo_Item_keyInfo(value.keyInfo, $.BER),
])
.filter((c) => !!c), $.BER);
};
}
return _cached_encoder_for_KeyManagementInfo_Item(value, elGetter);
}
exports._encode_KeyManagementInfo_Item = _encode_KeyManagementInfo_Item;
/* END_OF_SYMBOL_DEFINITION _encode_KeyManagementInfo_Item */
/* eslint-enable */
//# sourceMappingURL=KeyManagementInfo-Item.ta.js.map