@wildboar/pc
Version:
Trusted Computing Group Platform Certificate ASN.1 data structures in TypeScript
245 lines • 15.2 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports._encode_TBBSecurityAssertions = exports._decode_TBBSecurityAssertions = exports._extension_additions_list_spec_for_TBBSecurityAssertions = exports._root_component_type_list_2_spec_for_TBBSecurityAssertions = exports._root_component_type_list_1_spec_for_TBBSecurityAssertions = exports.TBBSecurityAssertions = exports._encode_MeasurementRootType = exports._decode_MeasurementRootType = exports.virtual = exports.MeasurementRootType_virtual = exports.physical = exports.MeasurementRootType_physical = exports.hybrid = exports.MeasurementRootType_hybrid = exports.nonHost = exports.MeasurementRootType_nonHost = exports.dynamic = exports.MeasurementRootType_dynamic = exports.static_ = exports.MeasurementRootType_static_ = exports._enum_for_MeasurementRootType = exports.MeasurementRootType = exports._encode_FIPSLevel = exports._decode_FIPSLevel = exports.FIPSLevel = exports._encode_CommonCriteriaMeasures = exports._decode_CommonCriteriaMeasures = exports.CommonCriteriaMeasures = void 0;
/* eslint-disable */
const asn1_ts_1 = require("asn1-ts");
const $ = require("asn1-ts/dist/node/functional");
const CommonCriteriaMeasures_ta_1 = require("../PlatformCertificateProfile/CommonCriteriaMeasures.ta");
var CommonCriteriaMeasures_ta_2 = require("../PlatformCertificateProfile/CommonCriteriaMeasures.ta");
Object.defineProperty(exports, "CommonCriteriaMeasures", { enumerable: true, get: function () { return CommonCriteriaMeasures_ta_2.CommonCriteriaMeasures; } });
Object.defineProperty(exports, "_decode_CommonCriteriaMeasures", { enumerable: true, get: function () { return CommonCriteriaMeasures_ta_2._decode_CommonCriteriaMeasures; } });
Object.defineProperty(exports, "_encode_CommonCriteriaMeasures", { enumerable: true, get: function () { return CommonCriteriaMeasures_ta_2._encode_CommonCriteriaMeasures; } });
const FIPSLevel_ta_1 = require("../PlatformCertificateProfile/FIPSLevel.ta");
var FIPSLevel_ta_2 = require("../PlatformCertificateProfile/FIPSLevel.ta");
Object.defineProperty(exports, "FIPSLevel", { enumerable: true, get: function () { return FIPSLevel_ta_2.FIPSLevel; } });
Object.defineProperty(exports, "_decode_FIPSLevel", { enumerable: true, get: function () { return FIPSLevel_ta_2._decode_FIPSLevel; } });
Object.defineProperty(exports, "_encode_FIPSLevel", { enumerable: true, get: function () { return FIPSLevel_ta_2._encode_FIPSLevel; } });
const MeasurementRootType_ta_1 = require("../PlatformCertificateProfile/MeasurementRootType.ta");
var MeasurementRootType_ta_2 = require("../PlatformCertificateProfile/MeasurementRootType.ta");
Object.defineProperty(exports, "MeasurementRootType", { enumerable: true, get: function () { return MeasurementRootType_ta_2.MeasurementRootType; } });
Object.defineProperty(exports, "_enum_for_MeasurementRootType", { enumerable: true, get: function () { return MeasurementRootType_ta_2._enum_for_MeasurementRootType; } });
Object.defineProperty(exports, "MeasurementRootType_static_", { enumerable: true, get: function () { return MeasurementRootType_ta_2.MeasurementRootType_static_; } }); /* IMPORTED_LONG_ENUMERATION_ITEM */
Object.defineProperty(exports, "static_", { enumerable: true, get: function () { return MeasurementRootType_ta_2.static_; } }); /* IMPORTED_SHORT_ENUMERATION_ITEM */
Object.defineProperty(exports, "MeasurementRootType_dynamic", { enumerable: true, get: function () { return MeasurementRootType_ta_2.MeasurementRootType_dynamic; } }); /* IMPORTED_LONG_ENUMERATION_ITEM */
Object.defineProperty(exports, "dynamic", { enumerable: true, get: function () { return MeasurementRootType_ta_2.dynamic; } }); /* IMPORTED_SHORT_ENUMERATION_ITEM */
Object.defineProperty(exports, "MeasurementRootType_nonHost", { enumerable: true, get: function () { return MeasurementRootType_ta_2.MeasurementRootType_nonHost; } }); /* IMPORTED_LONG_ENUMERATION_ITEM */
Object.defineProperty(exports, "nonHost", { enumerable: true, get: function () { return MeasurementRootType_ta_2.nonHost; } }); /* IMPORTED_SHORT_ENUMERATION_ITEM */
Object.defineProperty(exports, "MeasurementRootType_hybrid", { enumerable: true, get: function () { return MeasurementRootType_ta_2.MeasurementRootType_hybrid; } }); /* IMPORTED_LONG_ENUMERATION_ITEM */
Object.defineProperty(exports, "hybrid", { enumerable: true, get: function () { return MeasurementRootType_ta_2.hybrid; } }); /* IMPORTED_SHORT_ENUMERATION_ITEM */
Object.defineProperty(exports, "MeasurementRootType_physical", { enumerable: true, get: function () { return MeasurementRootType_ta_2.MeasurementRootType_physical; } }); /* IMPORTED_LONG_ENUMERATION_ITEM */
Object.defineProperty(exports, "physical", { enumerable: true, get: function () { return MeasurementRootType_ta_2.physical; } }); /* IMPORTED_SHORT_ENUMERATION_ITEM */
Object.defineProperty(exports, "MeasurementRootType_virtual", { enumerable: true, get: function () { return MeasurementRootType_ta_2.MeasurementRootType_virtual; } }); /* IMPORTED_LONG_ENUMERATION_ITEM */
Object.defineProperty(exports, "virtual", { enumerable: true, get: function () { return MeasurementRootType_ta_2.virtual; } }); /* IMPORTED_SHORT_ENUMERATION_ITEM */
Object.defineProperty(exports, "_decode_MeasurementRootType", { enumerable: true, get: function () { return MeasurementRootType_ta_2._decode_MeasurementRootType; } });
Object.defineProperty(exports, "_encode_MeasurementRootType", { enumerable: true, get: function () { return MeasurementRootType_ta_2._encode_MeasurementRootType; } });
const Version_ta_1 = require("./Version.ta");
/* START_OF_SYMBOL_DEFINITION TBBSecurityAssertions */
/**
* @summary TBBSecurityAssertions
* @description
*
* ### ASN.1 Definition:
*
* ```asn1
* TBBSecurityAssertions ::= SEQUENCE {
* version Version DEFAULT v1,
* ccInfo [0] IMPLICIT CommonCriteriaMeasures OPTIONAL,
* fipsLevel [1] IMPLICIT FIPSLevel OPTIONAL,
* rtmType [2] IMPLICIT MeasurementRootType OPTIONAL,
* iso9000Certified BOOLEAN DEFAULT FALSE,
* iso9000Uri IA5String (SIZE (1..urimax)) OPTIONAL }
* ```
*
* @class
*/
class TBBSecurityAssertions {
constructor(
/**
* @summary `version`.
* @public
* @readonly
*/
version,
/**
* @summary `ccInfo`.
* @public
* @readonly
*/
ccInfo,
/**
* @summary `fipsLevel`.
* @public
* @readonly
*/
fipsLevel,
/**
* @summary `rtmType`.
* @public
* @readonly
*/
rtmType,
/**
* @summary `iso9000Certified`.
* @public
* @readonly
*/
iso9000Certified,
/**
* @summary `iso9000Uri`.
* @public
* @readonly
*/
iso9000Uri) {
this.version = version;
this.ccInfo = ccInfo;
this.fipsLevel = fipsLevel;
this.rtmType = rtmType;
this.iso9000Certified = iso9000Certified;
this.iso9000Uri = iso9000Uri;
}
/**
* @summary Restructures an object into a TBBSecurityAssertions
* @description
*
* This takes an `object` and converts it to a `TBBSecurityAssertions`.
*
* @public
* @static
* @method
* @param {Object} _o An object having all of the keys and values of a `TBBSecurityAssertions`.
* @returns {TBBSecurityAssertions}
*/
static _from_object(_o) {
return new TBBSecurityAssertions(_o.version, _o.ccInfo, _o.fipsLevel, _o.rtmType, _o.iso9000Certified, _o.iso9000Uri);
}
/**
* @summary Getter that returns the default value for `version`.
* @public
* @static
* @method
*/
static get _default_value_for_version() { return Version_ta_1.v1; }
/**
* @summary Getter that returns the default value for `iso9000Certified`.
* @public
* @static
* @method
*/
static get _default_value_for_iso9000Certified() { return false; } /**
* @summary The enum used as the type of the component `rtmType`
* @public
* @static
*/
}
exports.TBBSecurityAssertions = TBBSecurityAssertions;
TBBSecurityAssertions._enum_for_rtmType = MeasurementRootType_ta_1._enum_for_MeasurementRootType;
/* END_OF_SYMBOL_DEFINITION TBBSecurityAssertions */
/* START_OF_SYMBOL_DEFINITION _root_component_type_list_1_spec_for_TBBSecurityAssertions */
/**
* @summary The Leading Root Component Types of TBBSecurityAssertions
* @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_TBBSecurityAssertions = [
/* FIXME: version COULD_NOT_RESOLVE_TYPE_DEF */ ,
new $.ComponentSpec("ccInfo", true, $.hasTag(asn1_ts_1.ASN1TagClass.context, 0), undefined, undefined),
new $.ComponentSpec("fipsLevel", true, $.hasTag(asn1_ts_1.ASN1TagClass.context, 1), undefined, undefined),
new $.ComponentSpec("rtmType", true, $.hasTag(asn1_ts_1.ASN1TagClass.context, 2), undefined, undefined),
new $.ComponentSpec("iso9000Certified", true, $.hasTag(asn1_ts_1.ASN1TagClass.universal, 1), undefined, undefined),
new $.ComponentSpec("iso9000Uri", true, $.hasTag(asn1_ts_1.ASN1TagClass.universal, 22), undefined, undefined)
];
/* END_OF_SYMBOL_DEFINITION _root_component_type_list_1_spec_for_TBBSecurityAssertions */
/* START_OF_SYMBOL_DEFINITION _root_component_type_list_2_spec_for_TBBSecurityAssertions */
/**
* @summary The Trailing Root Component Types of TBBSecurityAssertions
* @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_TBBSecurityAssertions = [];
/* END_OF_SYMBOL_DEFINITION _root_component_type_list_2_spec_for_TBBSecurityAssertions */
/* START_OF_SYMBOL_DEFINITION _extension_additions_list_spec_for_TBBSecurityAssertions */
/**
* @summary The Extension Addition Component Types of TBBSecurityAssertions
* @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_TBBSecurityAssertions = [];
/* END_OF_SYMBOL_DEFINITION _extension_additions_list_spec_for_TBBSecurityAssertions */
/* START_OF_SYMBOL_DEFINITION _cached_decoder_for_TBBSecurityAssertions */
let _cached_decoder_for_TBBSecurityAssertions = null;
/* END_OF_SYMBOL_DEFINITION _cached_decoder_for_TBBSecurityAssertions */
/* START_OF_SYMBOL_DEFINITION _decode_TBBSecurityAssertions */
/**
* @summary Decodes an ASN.1 element into a(n) TBBSecurityAssertions
* @function
* @param {_Element} el The element being decoded.
* @returns {TBBSecurityAssertions} The decoded data structure.
*/
function _decode_TBBSecurityAssertions(el) {
if (!_cached_decoder_for_TBBSecurityAssertions) {
_cached_decoder_for_TBBSecurityAssertions = function (el) {
/* START_OF_SEQUENCE_COMPONENT_DECLARATIONS */
let version = TBBSecurityAssertions._default_value_for_version;
let ccInfo;
let fipsLevel;
let rtmType;
let iso9000Certified = TBBSecurityAssertions._default_value_for_iso9000Certified;
let iso9000Uri;
/* END_OF_SEQUENCE_COMPONENT_DECLARATIONS */
/* START_OF_CALLBACKS_MAP */
const callbacks = {
"version": (_el) => { version = Version_ta_1._decode_Version(_el); },
"ccInfo": (_el) => { ccInfo = $._decode_implicit(() => CommonCriteriaMeasures_ta_1._decode_CommonCriteriaMeasures)(_el); },
"fipsLevel": (_el) => { fipsLevel = $._decode_implicit(() => FIPSLevel_ta_1._decode_FIPSLevel)(_el); },
"rtmType": (_el) => { rtmType = $._decode_implicit(() => MeasurementRootType_ta_1._decode_MeasurementRootType)(_el); },
"iso9000Certified": (_el) => { iso9000Certified = $._decodeBoolean(_el); },
"iso9000Uri": (_el) => { iso9000Uri = $._decodeIA5String(_el); }
};
/* END_OF_CALLBACKS_MAP */
$._parse_sequence(el, callbacks, exports._root_component_type_list_1_spec_for_TBBSecurityAssertions, exports._extension_additions_list_spec_for_TBBSecurityAssertions, exports._root_component_type_list_2_spec_for_TBBSecurityAssertions, undefined);
return new TBBSecurityAssertions(/* SEQUENCE_CONSTRUCTOR_CALL */ version, ccInfo, fipsLevel, rtmType, iso9000Certified, iso9000Uri);
};
}
return _cached_decoder_for_TBBSecurityAssertions(el);
}
exports._decode_TBBSecurityAssertions = _decode_TBBSecurityAssertions;
/* END_OF_SYMBOL_DEFINITION _decode_TBBSecurityAssertions */
/* START_OF_SYMBOL_DEFINITION _cached_encoder_for_TBBSecurityAssertions */
let _cached_encoder_for_TBBSecurityAssertions = null;
/* END_OF_SYMBOL_DEFINITION _cached_encoder_for_TBBSecurityAssertions */
/* START_OF_SYMBOL_DEFINITION _encode_TBBSecurityAssertions */
/**
* @summary Encodes a(n) TBBSecurityAssertions 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 TBBSecurityAssertions, encoded as an ASN.1 Element.
*/
function _encode_TBBSecurityAssertions(value, elGetter) {
if (!_cached_encoder_for_TBBSecurityAssertions) {
_cached_encoder_for_TBBSecurityAssertions = function (value, elGetter) {
return $._encodeSequence([].concat([
/* IF_DEFAULT */ (value.version === undefined || $.deepEq(value.version, TBBSecurityAssertions._default_value_for_version) ? undefined : Version_ta_1._encode_Version(value.version, $.BER)),
/* IF_ABSENT */ ((value.ccInfo === undefined) ? undefined : $._encode_implicit(asn1_ts_1.ASN1TagClass.context, 0, () => CommonCriteriaMeasures_ta_1._encode_CommonCriteriaMeasures, $.BER)(value.ccInfo, $.BER)),
/* IF_ABSENT */ ((value.fipsLevel === undefined) ? undefined : $._encode_implicit(asn1_ts_1.ASN1TagClass.context, 1, () => FIPSLevel_ta_1._encode_FIPSLevel, $.BER)(value.fipsLevel, $.BER)),
/* IF_ABSENT */ ((value.rtmType === undefined) ? undefined : $._encode_implicit(asn1_ts_1.ASN1TagClass.context, 2, () => MeasurementRootType_ta_1._encode_MeasurementRootType, $.BER)(value.rtmType, $.BER)),
/* IF_DEFAULT */ (value.iso9000Certified === undefined || $.deepEq(value.iso9000Certified, TBBSecurityAssertions._default_value_for_iso9000Certified) ? undefined : $._encodeBoolean(value.iso9000Certified, $.BER)),
/* IF_ABSENT */ ((value.iso9000Uri === undefined) ? undefined : $._encodeIA5String(value.iso9000Uri, $.BER))
]).filter((c) => (!!c)), $.BER);
};
}
return _cached_encoder_for_TBBSecurityAssertions(value, elGetter);
}
exports._encode_TBBSecurityAssertions = _encode_TBBSecurityAssertions;
/* END_OF_SYMBOL_DEFINITION _encode_TBBSecurityAssertions */
/* eslint-enable */
//# sourceMappingURL=TBBSecurityAssertions.ta.js.map