UNPKG

@wildboar/pc

Version:

Trusted Computing Group Platform Certificate ASN.1 data structures in TypeScript

288 lines 19.3 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports._encode_CommonCriteriaMeasures = exports._decode_CommonCriteriaMeasures = exports._extension_additions_list_spec_for_CommonCriteriaMeasures = exports._root_component_type_list_2_spec_for_CommonCriteriaMeasures = exports._root_component_type_list_1_spec_for_CommonCriteriaMeasures = exports.CommonCriteriaMeasures = exports._encode_URIReference = exports._decode_URIReference = exports.URIReference = exports._encode_StrengthOfFunction = exports._decode_StrengthOfFunction = exports.high = exports.StrengthOfFunction_high = exports.medium = exports.StrengthOfFunction_medium = exports.basic = exports.StrengthOfFunction_basic = exports._enum_for_StrengthOfFunction = exports.StrengthOfFunction = exports._encode_EvaluationAssuranceLevel = exports._decode_EvaluationAssuranceLevel = exports.level7 = exports.EvaluationAssuranceLevel_level7 = exports.level6 = exports.EvaluationAssuranceLevel_level6 = exports.level5 = exports.EvaluationAssuranceLevel_level5 = exports.level4 = exports.EvaluationAssuranceLevel_level4 = exports.level3 = exports.EvaluationAssuranceLevel_level3 = exports.level2 = exports.EvaluationAssuranceLevel_level2 = exports.levell = exports.EvaluationAssuranceLevel_levell = exports._enum_for_EvaluationAssuranceLevel = exports.EvaluationAssuranceLevel = void 0; /* eslint-disable */ const asn1_ts_1 = require("asn1-ts"); const $ = require("asn1-ts/dist/node/functional"); const EvaluationAssuranceLevel_ta_1 = require("../PlatformCertificateProfile/EvaluationAssuranceLevel.ta"); var EvaluationAssuranceLevel_ta_2 = require("../PlatformCertificateProfile/EvaluationAssuranceLevel.ta"); Object.defineProperty(exports, "EvaluationAssuranceLevel", { enumerable: true, get: function () { return EvaluationAssuranceLevel_ta_2.EvaluationAssuranceLevel; } }); Object.defineProperty(exports, "_enum_for_EvaluationAssuranceLevel", { enumerable: true, get: function () { return EvaluationAssuranceLevel_ta_2._enum_for_EvaluationAssuranceLevel; } }); Object.defineProperty(exports, "EvaluationAssuranceLevel_levell", { enumerable: true, get: function () { return EvaluationAssuranceLevel_ta_2.EvaluationAssuranceLevel_levell; } }); /* IMPORTED_LONG_ENUMERATION_ITEM */ Object.defineProperty(exports, "levell", { enumerable: true, get: function () { return EvaluationAssuranceLevel_ta_2.levell; } }); /* IMPORTED_SHORT_ENUMERATION_ITEM */ Object.defineProperty(exports, "EvaluationAssuranceLevel_level2", { enumerable: true, get: function () { return EvaluationAssuranceLevel_ta_2.EvaluationAssuranceLevel_level2; } }); /* IMPORTED_LONG_ENUMERATION_ITEM */ Object.defineProperty(exports, "level2", { enumerable: true, get: function () { return EvaluationAssuranceLevel_ta_2.level2; } }); /* IMPORTED_SHORT_ENUMERATION_ITEM */ Object.defineProperty(exports, "EvaluationAssuranceLevel_level3", { enumerable: true, get: function () { return EvaluationAssuranceLevel_ta_2.EvaluationAssuranceLevel_level3; } }); /* IMPORTED_LONG_ENUMERATION_ITEM */ Object.defineProperty(exports, "level3", { enumerable: true, get: function () { return EvaluationAssuranceLevel_ta_2.level3; } }); /* IMPORTED_SHORT_ENUMERATION_ITEM */ Object.defineProperty(exports, "EvaluationAssuranceLevel_level4", { enumerable: true, get: function () { return EvaluationAssuranceLevel_ta_2.EvaluationAssuranceLevel_level4; } }); /* IMPORTED_LONG_ENUMERATION_ITEM */ Object.defineProperty(exports, "level4", { enumerable: true, get: function () { return EvaluationAssuranceLevel_ta_2.level4; } }); /* IMPORTED_SHORT_ENUMERATION_ITEM */ Object.defineProperty(exports, "EvaluationAssuranceLevel_level5", { enumerable: true, get: function () { return EvaluationAssuranceLevel_ta_2.EvaluationAssuranceLevel_level5; } }); /* IMPORTED_LONG_ENUMERATION_ITEM */ Object.defineProperty(exports, "level5", { enumerable: true, get: function () { return EvaluationAssuranceLevel_ta_2.level5; } }); /* IMPORTED_SHORT_ENUMERATION_ITEM */ Object.defineProperty(exports, "EvaluationAssuranceLevel_level6", { enumerable: true, get: function () { return EvaluationAssuranceLevel_ta_2.EvaluationAssuranceLevel_level6; } }); /* IMPORTED_LONG_ENUMERATION_ITEM */ Object.defineProperty(exports, "level6", { enumerable: true, get: function () { return EvaluationAssuranceLevel_ta_2.level6; } }); /* IMPORTED_SHORT_ENUMERATION_ITEM */ Object.defineProperty(exports, "EvaluationAssuranceLevel_level7", { enumerable: true, get: function () { return EvaluationAssuranceLevel_ta_2.EvaluationAssuranceLevel_level7; } }); /* IMPORTED_LONG_ENUMERATION_ITEM */ Object.defineProperty(exports, "level7", { enumerable: true, get: function () { return EvaluationAssuranceLevel_ta_2.level7; } }); /* IMPORTED_SHORT_ENUMERATION_ITEM */ Object.defineProperty(exports, "_decode_EvaluationAssuranceLevel", { enumerable: true, get: function () { return EvaluationAssuranceLevel_ta_2._decode_EvaluationAssuranceLevel; } }); Object.defineProperty(exports, "_encode_EvaluationAssuranceLevel", { enumerable: true, get: function () { return EvaluationAssuranceLevel_ta_2._encode_EvaluationAssuranceLevel; } }); const StrengthOfFunction_ta_1 = require("../PlatformCertificateProfile/StrengthOfFunction.ta"); var StrengthOfFunction_ta_2 = require("../PlatformCertificateProfile/StrengthOfFunction.ta"); Object.defineProperty(exports, "StrengthOfFunction", { enumerable: true, get: function () { return StrengthOfFunction_ta_2.StrengthOfFunction; } }); Object.defineProperty(exports, "_enum_for_StrengthOfFunction", { enumerable: true, get: function () { return StrengthOfFunction_ta_2._enum_for_StrengthOfFunction; } }); Object.defineProperty(exports, "StrengthOfFunction_basic", { enumerable: true, get: function () { return StrengthOfFunction_ta_2.StrengthOfFunction_basic; } }); /* IMPORTED_LONG_ENUMERATION_ITEM */ Object.defineProperty(exports, "basic", { enumerable: true, get: function () { return StrengthOfFunction_ta_2.basic; } }); /* IMPORTED_SHORT_ENUMERATION_ITEM */ Object.defineProperty(exports, "StrengthOfFunction_medium", { enumerable: true, get: function () { return StrengthOfFunction_ta_2.StrengthOfFunction_medium; } }); /* IMPORTED_LONG_ENUMERATION_ITEM */ Object.defineProperty(exports, "medium", { enumerable: true, get: function () { return StrengthOfFunction_ta_2.medium; } }); /* IMPORTED_SHORT_ENUMERATION_ITEM */ Object.defineProperty(exports, "StrengthOfFunction_high", { enumerable: true, get: function () { return StrengthOfFunction_ta_2.StrengthOfFunction_high; } }); /* IMPORTED_LONG_ENUMERATION_ITEM */ Object.defineProperty(exports, "high", { enumerable: true, get: function () { return StrengthOfFunction_ta_2.high; } }); /* IMPORTED_SHORT_ENUMERATION_ITEM */ Object.defineProperty(exports, "_decode_StrengthOfFunction", { enumerable: true, get: function () { return StrengthOfFunction_ta_2._decode_StrengthOfFunction; } }); Object.defineProperty(exports, "_encode_StrengthOfFunction", { enumerable: true, get: function () { return StrengthOfFunction_ta_2._encode_StrengthOfFunction; } }); const URIReference_ta_1 = require("../PlatformCertificateProfile/URIReference.ta"); var URIReference_ta_2 = require("../PlatformCertificateProfile/URIReference.ta"); Object.defineProperty(exports, "URIReference", { enumerable: true, get: function () { return URIReference_ta_2.URIReference; } }); Object.defineProperty(exports, "_decode_URIReference", { enumerable: true, get: function () { return URIReference_ta_2._decode_URIReference; } }); Object.defineProperty(exports, "_encode_URIReference", { enumerable: true, get: function () { return URIReference_ta_2._encode_URIReference; } }); const EvaluationStatus_ta_1 = require("./EvaluationStatus.ta"); /* START_OF_SYMBOL_DEFINITION CommonCriteriaMeasures */ /** * @summary CommonCriteriaMeasures * @description * * ### ASN.1 Definition: * * ```asn1 * CommonCriteriaMeasures ::= SEQUENCE { * version IA5String (SIZE (1..strmax)), -- “2.2” or “3.1”; future syntax defined by CC * assurancelevel EvaluationAssuranceLevel, * evaluationStatus EvalutionStatus, * plus BOOLEAN DEFAULT FALSE, * strengthOfFunction [0] IMPLICIT StrengthOfFunction OPTIONAL, * profileOid [1] IMPLICIT OBJECT IDENTIFIER OPTIONAL, * profileUri [2] IMPLICIT URIReference OPTIONAL, * targetOid [3] IMPLICIT OBJECT IDENTIFIER OPTIONAL, * targetUri [4] IMPLICIT URIReference OPTIONAL } * ``` * * @class */ class CommonCriteriaMeasures { constructor( /** * @summary `version`. * @public * @readonly */ version, /** * @summary `assurancelevel`. * @public * @readonly */ assurancelevel, /** * @summary `evaluationStatus`. * @public * @readonly */ evaluationStatus, /** * @summary `plus`. * @public * @readonly */ plus, /** * @summary `strengthOfFunction`. * @public * @readonly */ strengthOfFunction, /** * @summary `profileOid`. * @public * @readonly */ profileOid, /** * @summary `profileUri`. * @public * @readonly */ profileUri, /** * @summary `targetOid`. * @public * @readonly */ targetOid, /** * @summary `targetUri`. * @public * @readonly */ targetUri) { this.version = version; this.assurancelevel = assurancelevel; this.evaluationStatus = evaluationStatus; this.plus = plus; this.strengthOfFunction = strengthOfFunction; this.profileOid = profileOid; this.profileUri = profileUri; this.targetOid = targetOid; this.targetUri = targetUri; } /** * @summary Restructures an object into a CommonCriteriaMeasures * @description * * This takes an `object` and converts it to a `CommonCriteriaMeasures`. * * @public * @static * @method * @param {Object} _o An object having all of the keys and values of a `CommonCriteriaMeasures`. * @returns {CommonCriteriaMeasures} */ static _from_object(_o) { return new CommonCriteriaMeasures(_o.version, _o.assurancelevel, _o.evaluationStatus, _o.plus, _o.strengthOfFunction, _o.profileOid, _o.profileUri, _o.targetOid, _o.targetUri); } /** * @summary Getter that returns the default value for `plus`. * @public * @static * @method */ static get _default_value_for_plus() { return false; } /** * @summary The enum used as the type of the component `assurancelevel` * @public * @static */ } exports.CommonCriteriaMeasures = CommonCriteriaMeasures; CommonCriteriaMeasures._enum_for_assurancelevel = EvaluationAssuranceLevel_ta_1._enum_for_EvaluationAssuranceLevel; /** * @summary The enum used as the type of the component `strengthOfFunction` * @public * @static */ CommonCriteriaMeasures._enum_for_strengthOfFunction = StrengthOfFunction_ta_1._enum_for_StrengthOfFunction; /* END_OF_SYMBOL_DEFINITION CommonCriteriaMeasures */ /* START_OF_SYMBOL_DEFINITION _root_component_type_list_1_spec_for_CommonCriteriaMeasures */ /** * @summary The Leading Root Component Types of CommonCriteriaMeasures * @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_CommonCriteriaMeasures = [ new $.ComponentSpec("version", false, $.hasTag(asn1_ts_1.ASN1TagClass.universal, 22), undefined, undefined), new $.ComponentSpec("assurancelevel", false, $.hasTag(asn1_ts_1.ASN1TagClass.universal, 10), undefined, undefined), /* FIXME: evaluationStatus COULD_NOT_RESOLVE_TYPE_DEF */ , new $.ComponentSpec("plus", true, $.hasTag(asn1_ts_1.ASN1TagClass.universal, 1), undefined, undefined), new $.ComponentSpec("strengthOfFunction", true, $.hasTag(asn1_ts_1.ASN1TagClass.context, 0), undefined, undefined), new $.ComponentSpec("profileOid", true, $.hasTag(asn1_ts_1.ASN1TagClass.context, 1), undefined, undefined), new $.ComponentSpec("profileUri", true, $.hasTag(asn1_ts_1.ASN1TagClass.context, 2), undefined, undefined), new $.ComponentSpec("targetOid", true, $.hasTag(asn1_ts_1.ASN1TagClass.context, 3), undefined, undefined), new $.ComponentSpec("targetUri", true, $.hasTag(asn1_ts_1.ASN1TagClass.context, 4), undefined, undefined) ]; /* END_OF_SYMBOL_DEFINITION _root_component_type_list_1_spec_for_CommonCriteriaMeasures */ /* START_OF_SYMBOL_DEFINITION _root_component_type_list_2_spec_for_CommonCriteriaMeasures */ /** * @summary The Trailing Root Component Types of CommonCriteriaMeasures * @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_CommonCriteriaMeasures = []; /* END_OF_SYMBOL_DEFINITION _root_component_type_list_2_spec_for_CommonCriteriaMeasures */ /* START_OF_SYMBOL_DEFINITION _extension_additions_list_spec_for_CommonCriteriaMeasures */ /** * @summary The Extension Addition Component Types of CommonCriteriaMeasures * @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_CommonCriteriaMeasures = []; /* END_OF_SYMBOL_DEFINITION _extension_additions_list_spec_for_CommonCriteriaMeasures */ /* START_OF_SYMBOL_DEFINITION _cached_decoder_for_CommonCriteriaMeasures */ let _cached_decoder_for_CommonCriteriaMeasures = null; /* END_OF_SYMBOL_DEFINITION _cached_decoder_for_CommonCriteriaMeasures */ /* START_OF_SYMBOL_DEFINITION _decode_CommonCriteriaMeasures */ /** * @summary Decodes an ASN.1 element into a(n) CommonCriteriaMeasures * @function * @param {_Element} el The element being decoded. * @returns {CommonCriteriaMeasures} The decoded data structure. */ function _decode_CommonCriteriaMeasures(el) { if (!_cached_decoder_for_CommonCriteriaMeasures) { _cached_decoder_for_CommonCriteriaMeasures = function (el) { /* START_OF_SEQUENCE_COMPONENT_DECLARATIONS */ let version; let assurancelevel; let evaluationStatus; let plus = CommonCriteriaMeasures._default_value_for_plus; let strengthOfFunction; let profileOid; let profileUri; let targetOid; let targetUri; /* END_OF_SEQUENCE_COMPONENT_DECLARATIONS */ /* START_OF_CALLBACKS_MAP */ const callbacks = { "version": (_el) => { version = $._decodeIA5String(_el); }, "assurancelevel": (_el) => { assurancelevel = EvaluationAssuranceLevel_ta_1._decode_EvaluationAssuranceLevel(_el); }, "evaluationStatus": (_el) => { evaluationStatus = EvaluationStatus_ta_1._decode_EvaluationStatus(_el); }, "plus": (_el) => { plus = $._decodeBoolean(_el); }, "strengthOfFunction": (_el) => { strengthOfFunction = $._decode_implicit(() => StrengthOfFunction_ta_1._decode_StrengthOfFunction)(_el); }, "profileOid": (_el) => { profileOid = $._decode_implicit(() => $._decodeObjectIdentifier)(_el); }, "profileUri": (_el) => { profileUri = $._decode_implicit(() => URIReference_ta_1._decode_URIReference)(_el); }, "targetOid": (_el) => { targetOid = $._decode_implicit(() => $._decodeObjectIdentifier)(_el); }, "targetUri": (_el) => { targetUri = $._decode_implicit(() => URIReference_ta_1._decode_URIReference)(_el); } }; /* END_OF_CALLBACKS_MAP */ $._parse_sequence(el, callbacks, exports._root_component_type_list_1_spec_for_CommonCriteriaMeasures, exports._extension_additions_list_spec_for_CommonCriteriaMeasures, exports._root_component_type_list_2_spec_for_CommonCriteriaMeasures, undefined); return new CommonCriteriaMeasures(/* SEQUENCE_CONSTRUCTOR_CALL */ version, assurancelevel, evaluationStatus, plus, strengthOfFunction, profileOid, profileUri, targetOid, targetUri); }; } return _cached_decoder_for_CommonCriteriaMeasures(el); } exports._decode_CommonCriteriaMeasures = _decode_CommonCriteriaMeasures; /* END_OF_SYMBOL_DEFINITION _decode_CommonCriteriaMeasures */ /* START_OF_SYMBOL_DEFINITION _cached_encoder_for_CommonCriteriaMeasures */ let _cached_encoder_for_CommonCriteriaMeasures = null; /* END_OF_SYMBOL_DEFINITION _cached_encoder_for_CommonCriteriaMeasures */ /* START_OF_SYMBOL_DEFINITION _encode_CommonCriteriaMeasures */ /** * @summary Encodes a(n) CommonCriteriaMeasures 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 CommonCriteriaMeasures, encoded as an ASN.1 Element. */ function _encode_CommonCriteriaMeasures(value, elGetter) { if (!_cached_encoder_for_CommonCriteriaMeasures) { _cached_encoder_for_CommonCriteriaMeasures = function (value, elGetter) { return $._encodeSequence([].concat([ /* REQUIRED */ $._encodeIA5String(value.version, $.BER), /* REQUIRED */ EvaluationAssuranceLevel_ta_1._encode_EvaluationAssuranceLevel(value.assurancelevel, $.BER), /* REQUIRED */ EvaluationStatus_ta_1._encode_EvaluationStatus(value.evaluationStatus, $.BER), /* IF_DEFAULT */ (value.plus === undefined || $.deepEq(value.plus, CommonCriteriaMeasures._default_value_for_plus) ? undefined : $._encodeBoolean(value.plus, $.BER)), /* IF_ABSENT */ ((value.strengthOfFunction === undefined) ? undefined : $._encode_implicit(asn1_ts_1.ASN1TagClass.context, 0, () => StrengthOfFunction_ta_1._encode_StrengthOfFunction, $.BER)(value.strengthOfFunction, $.BER)), /* IF_ABSENT */ ((value.profileOid === undefined) ? undefined : $._encode_implicit(asn1_ts_1.ASN1TagClass.context, 1, () => $._encodeObjectIdentifier, $.BER)(value.profileOid, $.BER)), /* IF_ABSENT */ ((value.profileUri === undefined) ? undefined : $._encode_implicit(asn1_ts_1.ASN1TagClass.context, 2, () => URIReference_ta_1._encode_URIReference, $.BER)(value.profileUri, $.BER)), /* IF_ABSENT */ ((value.targetOid === undefined) ? undefined : $._encode_implicit(asn1_ts_1.ASN1TagClass.context, 3, () => $._encodeObjectIdentifier, $.BER)(value.targetOid, $.BER)), /* IF_ABSENT */ ((value.targetUri === undefined) ? undefined : $._encode_implicit(asn1_ts_1.ASN1TagClass.context, 4, () => URIReference_ta_1._encode_URIReference, $.BER)(value.targetUri, $.BER)) ]).filter((c) => (!!c)), $.BER); }; } return _cached_encoder_for_CommonCriteriaMeasures(value, elGetter); } exports._encode_CommonCriteriaMeasures = _encode_CommonCriteriaMeasures; /* END_OF_SYMBOL_DEFINITION _encode_CommonCriteriaMeasures */ /* eslint-enable */ //# sourceMappingURL=CommonCriteriaMeasures.ta.js.map