@wildboar/pkcs
Version:
Public Key Cryptography Standard PDUs in TypeScript
163 lines • 6.61 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports._encode_SecurityEnvironmentInfo = exports._decode_SecurityEnvironmentInfo = exports._extension_additions_list_spec_for_SecurityEnvironmentInfo = exports._root_component_type_list_2_spec_for_SecurityEnvironmentInfo = exports._root_component_type_list_1_spec_for_SecurityEnvironmentInfo = exports.SecurityEnvironmentInfo = void 0;
/* eslint-disable */
const asn1_ts_1 = require("asn1-ts");
const $ = require("asn1-ts/dist/node/functional");
/* START_OF_SYMBOL_DEFINITION SecurityEnvironmentInfo */
/**
* @summary SecurityEnvironmentInfo
* @description
*
* ### ASN.1 Definition:
*
* ```asn1
* SecurityEnvironmentInfo ::= SEQUENCE {
* se INTEGER (0..pkcs15-ub-seInfo),
* owner OBJECT IDENTIFIER,
* ... -- For future extensions
* }
* ```
*
* @class
*/
class SecurityEnvironmentInfo {
constructor(
/**
* @summary `se`.
* @public
* @readonly
*/
se,
/**
* @summary `owner`.
* @public
* @readonly
*/
owner,
/**
* @summary Extensions that are not recognized.
* @public
* @readonly
*/
_unrecognizedExtensionsList = []) {
this.se = se;
this.owner = owner;
this._unrecognizedExtensionsList = _unrecognizedExtensionsList;
}
/**
* @summary Restructures an object into a SecurityEnvironmentInfo
* @description
*
* This takes an `object` and converts it to a `SecurityEnvironmentInfo`.
*
* @public
* @static
* @method
* @param {Object} _o An object having all of the keys and values of a `SecurityEnvironmentInfo`.
* @returns {SecurityEnvironmentInfo}
*/
static _from_object(_o) {
return new SecurityEnvironmentInfo(_o.se, _o.owner, _o._unrecognizedExtensionsList);
}
}
exports.SecurityEnvironmentInfo = SecurityEnvironmentInfo;
/* END_OF_SYMBOL_DEFINITION SecurityEnvironmentInfo */
/* START_OF_SYMBOL_DEFINITION _root_component_type_list_1_spec_for_SecurityEnvironmentInfo */
/**
* @summary The Leading Root Component Types of SecurityEnvironmentInfo
* @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_SecurityEnvironmentInfo = [
new $.ComponentSpec("se", false, $.hasTag(asn1_ts_1.ASN1TagClass.universal, 2), undefined, undefined),
new $.ComponentSpec("owner", false, $.hasTag(asn1_ts_1.ASN1TagClass.universal, 6), undefined, undefined),
];
/* END_OF_SYMBOL_DEFINITION _root_component_type_list_1_spec_for_SecurityEnvironmentInfo */
/* START_OF_SYMBOL_DEFINITION _root_component_type_list_2_spec_for_SecurityEnvironmentInfo */
/**
* @summary The Trailing Root Component Types of SecurityEnvironmentInfo
* @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_SecurityEnvironmentInfo = [];
/* END_OF_SYMBOL_DEFINITION _root_component_type_list_2_spec_for_SecurityEnvironmentInfo */
/* START_OF_SYMBOL_DEFINITION _extension_additions_list_spec_for_SecurityEnvironmentInfo */
/**
* @summary The Extension Addition Component Types of SecurityEnvironmentInfo
* @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_SecurityEnvironmentInfo = [];
/* END_OF_SYMBOL_DEFINITION _extension_additions_list_spec_for_SecurityEnvironmentInfo */
/* START_OF_SYMBOL_DEFINITION _cached_decoder_for_SecurityEnvironmentInfo */
let _cached_decoder_for_SecurityEnvironmentInfo = null;
/* END_OF_SYMBOL_DEFINITION _cached_decoder_for_SecurityEnvironmentInfo */
/* START_OF_SYMBOL_DEFINITION _decode_SecurityEnvironmentInfo */
/**
* @summary Decodes an ASN.1 element into a(n) SecurityEnvironmentInfo
* @function
* @param {_Element} el The element being decoded.
* @returns {SecurityEnvironmentInfo} The decoded data structure.
*/
function _decode_SecurityEnvironmentInfo(el) {
if (!_cached_decoder_for_SecurityEnvironmentInfo) {
_cached_decoder_for_SecurityEnvironmentInfo = function (el) {
const sequence = el.sequence;
if (sequence.length < 2) {
throw new asn1_ts_1.ASN1ConstructionError("SecurityEnvironmentInfo contained only " +
sequence.length.toString() +
" elements.");
}
sequence[0].name = "se";
sequence[1].name = "owner";
let se;
let owner;
se = $._decodeInteger(sequence[0]);
owner = $._decodeObjectIdentifier(sequence[1]);
return new SecurityEnvironmentInfo(se, owner, sequence.slice(2));
};
}
return _cached_decoder_for_SecurityEnvironmentInfo(el);
}
exports._decode_SecurityEnvironmentInfo = _decode_SecurityEnvironmentInfo;
/* END_OF_SYMBOL_DEFINITION _decode_SecurityEnvironmentInfo */
/* START_OF_SYMBOL_DEFINITION _cached_encoder_for_SecurityEnvironmentInfo */
let _cached_encoder_for_SecurityEnvironmentInfo = null;
/* END_OF_SYMBOL_DEFINITION _cached_encoder_for_SecurityEnvironmentInfo */
/* START_OF_SYMBOL_DEFINITION _encode_SecurityEnvironmentInfo */
/**
* @summary Encodes a(n) SecurityEnvironmentInfo 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 SecurityEnvironmentInfo, encoded as an ASN.1 Element.
*/
function _encode_SecurityEnvironmentInfo(value, elGetter) {
if (!_cached_encoder_for_SecurityEnvironmentInfo) {
_cached_encoder_for_SecurityEnvironmentInfo = function (value, elGetter) {
return $._encodeSequence([]
.concat([
/* REQUIRED */ $._encodeInteger(value.se, $.BER),
/* REQUIRED */ $._encodeObjectIdentifier(value.owner, $.BER),
], value._unrecognizedExtensionsList
? value._unrecognizedExtensionsList
: [])
.filter((c) => !!c), $.BER);
};
}
return _cached_encoder_for_SecurityEnvironmentInfo(value, elGetter);
}
exports._encode_SecurityEnvironmentInfo = _encode_SecurityEnvironmentInfo;
/* END_OF_SYMBOL_DEFINITION _encode_SecurityEnvironmentInfo */
/* eslint-enable */
//# sourceMappingURL=SecurityEnvironmentInfo.ta.js.map