@wildboar/pkcs
Version:
Public Key Cryptography Standard PDUs in TypeScript
176 lines • 7.83 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports._encode_PublicDSAKeyAttributes = exports._decode_PublicDSAKeyAttributes = exports._extension_additions_list_spec_for_PublicDSAKeyAttributes = exports._root_component_type_list_2_spec_for_PublicDSAKeyAttributes = exports._root_component_type_list_1_spec_for_PublicDSAKeyAttributes = exports.PublicDSAKeyAttributes = void 0;
/* eslint-disable */
const DomainParameters_ta_1 = require("@wildboar/ansi-x9-42/src/lib/modules/ANSI-X9-42/DomainParameters.ta");
const $ = require("asn1-ts/dist/node/functional");
const DSAPublicKeyChoice_ta_1 = require("../PKCS-15/DSAPublicKeyChoice.ta");
const KeyInfo_ta_1 = require("../PKCS-15/KeyInfo.ta");
const ObjectValue_ta_1 = require("../PKCS-15/ObjectValue.ta");
const PublicKeyOperations_ta_1 = require("../PKCS-15/PublicKeyOperations.ta");
/* START_OF_SYMBOL_DEFINITION PublicDSAKeyAttributes */
/**
* @summary PublicDSAKeyAttributes
* @description
*
* ### ASN.1 Definition:
*
* ```asn1
* PublicDSAKeyAttributes ::= SEQUENCE {
* value ObjectValue {DSAPublicKeyChoice},
* keyInfo KeyInfo {DomainParameters, PublicKeyOperations} OPTIONAL,
* ... -- For future extensions
* }
* ```
*
* @class
*/
class PublicDSAKeyAttributes {
constructor(
/**
* @summary `value`.
* @public
* @readonly
*/
value,
/**
* @summary `keyInfo`.
* @public
* @readonly
*/
keyInfo,
/**
* @summary Extensions that are not recognized.
* @public
* @readonly
*/
_unrecognizedExtensionsList = []) {
this.value = value;
this.keyInfo = keyInfo;
this._unrecognizedExtensionsList = _unrecognizedExtensionsList;
}
/**
* @summary Restructures an object into a PublicDSAKeyAttributes
* @description
*
* This takes an `object` and converts it to a `PublicDSAKeyAttributes`.
*
* @public
* @static
* @method
* @param {Object} _o An object having all of the keys and values of a `PublicDSAKeyAttributes`.
* @returns {PublicDSAKeyAttributes}
*/
static _from_object(_o) {
return new PublicDSAKeyAttributes(_o.value, _o.keyInfo, _o._unrecognizedExtensionsList);
}
}
exports.PublicDSAKeyAttributes = PublicDSAKeyAttributes;
/* END_OF_SYMBOL_DEFINITION PublicDSAKeyAttributes */
/* START_OF_SYMBOL_DEFINITION _root_component_type_list_1_spec_for_PublicDSAKeyAttributes */
/**
* @summary The Leading Root Component Types of PublicDSAKeyAttributes
* @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_PublicDSAKeyAttributes = [
new $.ComponentSpec("value", false, $.hasAnyTag, undefined, undefined),
new $.ComponentSpec("keyInfo", true, $.hasAnyTag, undefined, undefined),
];
/* END_OF_SYMBOL_DEFINITION _root_component_type_list_1_spec_for_PublicDSAKeyAttributes */
/* START_OF_SYMBOL_DEFINITION _root_component_type_list_2_spec_for_PublicDSAKeyAttributes */
/**
* @summary The Trailing Root Component Types of PublicDSAKeyAttributes
* @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_PublicDSAKeyAttributes = [];
/* END_OF_SYMBOL_DEFINITION _root_component_type_list_2_spec_for_PublicDSAKeyAttributes */
/* START_OF_SYMBOL_DEFINITION _extension_additions_list_spec_for_PublicDSAKeyAttributes */
/**
* @summary The Extension Addition Component Types of PublicDSAKeyAttributes
* @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_PublicDSAKeyAttributes = [];
/* END_OF_SYMBOL_DEFINITION _extension_additions_list_spec_for_PublicDSAKeyAttributes */
/* START_OF_SYMBOL_DEFINITION _cached_decoder_for_PublicDSAKeyAttributes */
let _cached_decoder_for_PublicDSAKeyAttributes = null;
/* END_OF_SYMBOL_DEFINITION _cached_decoder_for_PublicDSAKeyAttributes */
/* START_OF_SYMBOL_DEFINITION _decode_PublicDSAKeyAttributes */
/**
* @summary Decodes an ASN.1 element into a(n) PublicDSAKeyAttributes
* @function
* @param {_Element} el The element being decoded.
* @returns {PublicDSAKeyAttributes} The decoded data structure.
*/
function _decode_PublicDSAKeyAttributes(el) {
if (!_cached_decoder_for_PublicDSAKeyAttributes) {
_cached_decoder_for_PublicDSAKeyAttributes = function (el) {
/* START_OF_SEQUENCE_COMPONENT_DECLARATIONS */
let value;
let keyInfo;
let _unrecognizedExtensionsList = [];
/* END_OF_SEQUENCE_COMPONENT_DECLARATIONS */
/* START_OF_CALLBACKS_MAP */
const callbacks = {
value: (_el) => {
value = ObjectValue_ta_1._get_decoder_for_ObjectValue(DSAPublicKeyChoice_ta_1._decode_DSAPublicKeyChoice)(_el);
},
keyInfo: (_el) => {
keyInfo = KeyInfo_ta_1._get_decoder_for_KeyInfo(DomainParameters_ta_1._decode_DomainParameters, PublicKeyOperations_ta_1._decode_PublicKeyOperations)(_el);
},
};
/* END_OF_CALLBACKS_MAP */
$._parse_sequence(el, callbacks, exports._root_component_type_list_1_spec_for_PublicDSAKeyAttributes, exports._extension_additions_list_spec_for_PublicDSAKeyAttributes, exports._root_component_type_list_2_spec_for_PublicDSAKeyAttributes, (ext) => {
_unrecognizedExtensionsList.push(ext);
});
return new PublicDSAKeyAttributes(
/* SEQUENCE_CONSTRUCTOR_CALL */ value, keyInfo, _unrecognizedExtensionsList);
};
}
return _cached_decoder_for_PublicDSAKeyAttributes(el);
}
exports._decode_PublicDSAKeyAttributes = _decode_PublicDSAKeyAttributes;
/* END_OF_SYMBOL_DEFINITION _decode_PublicDSAKeyAttributes */
/* START_OF_SYMBOL_DEFINITION _cached_encoder_for_PublicDSAKeyAttributes */
let _cached_encoder_for_PublicDSAKeyAttributes = null;
/* END_OF_SYMBOL_DEFINITION _cached_encoder_for_PublicDSAKeyAttributes */
/* START_OF_SYMBOL_DEFINITION _encode_PublicDSAKeyAttributes */
/**
* @summary Encodes a(n) PublicDSAKeyAttributes 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 PublicDSAKeyAttributes, encoded as an ASN.1 Element.
*/
function _encode_PublicDSAKeyAttributes(value, elGetter) {
if (!_cached_encoder_for_PublicDSAKeyAttributes) {
_cached_encoder_for_PublicDSAKeyAttributes = function (value, elGetter) {
return $._encodeSequence([]
.concat([
/* REQUIRED */ ObjectValue_ta_1._get_encoder_for_ObjectValue(DSAPublicKeyChoice_ta_1._encode_DSAPublicKeyChoice)(value.value, $.BER),
/* IF_ABSENT */ value.keyInfo === undefined
? undefined
: KeyInfo_ta_1._get_encoder_for_KeyInfo(DomainParameters_ta_1._encode_DomainParameters, PublicKeyOperations_ta_1._encode_PublicKeyOperations)(value.keyInfo, $.BER),
], value._unrecognizedExtensionsList
? value._unrecognizedExtensionsList
: [])
.filter((c) => !!c), $.BER);
};
}
return _cached_encoder_for_PublicDSAKeyAttributes(value, elGetter);
}
exports._encode_PublicDSAKeyAttributes = _encode_PublicDSAKeyAttributes;
/* END_OF_SYMBOL_DEFINITION _encode_PublicDSAKeyAttributes */
/* eslint-enable */
//# sourceMappingURL=PublicDSAKeyAttributes.ta.js.map