UNPKG

pkcs-ts

Version:

PKCS #1 through #15 (Except #11) - Private and Public Keys, Certificates, and More

65 lines 3.86 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports._encode_PBMAC1_params = exports._decode_PBMAC1_params = exports._extension_additions_list_spec_for_PBMAC1_params = exports._root_component_type_list_2_spec_for_PBMAC1_params = exports._root_component_type_list_1_spec_for_PBMAC1_params = exports.PBMAC1_params = exports._encode_AlgorithmIdentifier = exports._decode_AlgorithmIdentifier = exports.AlgorithmIdentifier = void 0; const tslib_1 = require("tslib"); const asn1_ts_1 = require("asn1-ts"); const $ = tslib_1.__importStar(require("asn1-ts/dist/node/functional")); const AlgorithmIdentifier_ta_1 = require("../PKCS5v2-1/AlgorithmIdentifier.ta"); var AlgorithmIdentifier_ta_2 = require("../PKCS5v2-1/AlgorithmIdentifier.ta"); Object.defineProperty(exports, "AlgorithmIdentifier", { enumerable: true, get: function () { return AlgorithmIdentifier_ta_2.AlgorithmIdentifier; } }); Object.defineProperty(exports, "_decode_AlgorithmIdentifier", { enumerable: true, get: function () { return AlgorithmIdentifier_ta_2._decode_AlgorithmIdentifier; } }); Object.defineProperty(exports, "_encode_AlgorithmIdentifier", { enumerable: true, get: function () { return AlgorithmIdentifier_ta_2._encode_AlgorithmIdentifier; } }); class PBMAC1_params { constructor(keyDerivationFunc, messageAuthScheme) { this.keyDerivationFunc = keyDerivationFunc; this.messageAuthScheme = messageAuthScheme; } static _from_object(_o) { return new PBMAC1_params(_o.keyDerivationFunc, _o.messageAuthScheme); } } exports.PBMAC1_params = PBMAC1_params; exports._root_component_type_list_1_spec_for_PBMAC1_params = [ new $.ComponentSpec("keyDerivationFunc", false, $.hasTag(asn1_ts_1.ASN1TagClass.universal, 16), undefined, undefined), new $.ComponentSpec("messageAuthScheme", false, $.hasTag(asn1_ts_1.ASN1TagClass.universal, 16), undefined, undefined), ]; exports._root_component_type_list_2_spec_for_PBMAC1_params = []; exports._extension_additions_list_spec_for_PBMAC1_params = []; let _cached_decoder_for_PBMAC1_params = null; function _decode_PBMAC1_params(el) { if (!_cached_decoder_for_PBMAC1_params) { _cached_decoder_for_PBMAC1_params = function (el) { const sequence = el.sequence; if (sequence.length < 2) { throw new asn1_ts_1.ASN1ConstructionError("PBMAC1-params contained only " + sequence.length.toString() + " elements."); } sequence[0].name = "keyDerivationFunc"; sequence[1].name = "messageAuthScheme"; let keyDerivationFunc; let messageAuthScheme; keyDerivationFunc = AlgorithmIdentifier_ta_1._decode_AlgorithmIdentifier(sequence[0]); messageAuthScheme = AlgorithmIdentifier_ta_1._decode_AlgorithmIdentifier(sequence[1]); return new PBMAC1_params(keyDerivationFunc, messageAuthScheme); }; } return _cached_decoder_for_PBMAC1_params(el); } exports._decode_PBMAC1_params = _decode_PBMAC1_params; let _cached_encoder_for_PBMAC1_params = null; function _encode_PBMAC1_params(value, elGetter) { if (!_cached_encoder_for_PBMAC1_params) { _cached_encoder_for_PBMAC1_params = function (value, elGetter) { return $._encodeSequence([] .concat([ AlgorithmIdentifier_ta_1._encode_AlgorithmIdentifier(value.keyDerivationFunc, $.BER), AlgorithmIdentifier_ta_1._encode_AlgorithmIdentifier(value.messageAuthScheme, $.BER), ]) .filter((c) => !!c), $.BER); }; } return _cached_encoder_for_PBMAC1_params(value, elGetter); } exports._encode_PBMAC1_params = _encode_PBMAC1_params; //# sourceMappingURL=PBMAC1-params.ta.js.map