UNPKG

@wildboar/pkcs

Version:
78 lines 5.62 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports._encode_RecipientInfo = exports._decode_RecipientInfo = exports._encode_KeyTransportRecipientInfo = exports._decode_KeyTransportRecipientInfo = exports.KeyTransportRecipientInfo = exports._encode_KeyEncryptionKeyRecipientInfo = exports._decode_KeyEncryptionKeyRecipientInfo = exports.KeyEncryptionKeyRecipientInfo = exports._encode_KeyAgreementRecipientInfo = exports._decode_KeyAgreementRecipientInfo = exports.KeyAgreementRecipientInfo = void 0; /* eslint-disable */ const asn1_ts_1 = require("asn1-ts"); const $ = require("asn1-ts/dist/node/functional"); const KeyAgreementRecipientInfo_ta_1 = require("../PKCS7/KeyAgreementRecipientInfo.ta"); const KeyEncryptionKeyRecipientInfo_ta_1 = require("../PKCS7/KeyEncryptionKeyRecipientInfo.ta"); const KeyTransportRecipientInfo_ta_1 = require("../PKCS7/KeyTransportRecipientInfo.ta"); var KeyAgreementRecipientInfo_ta_2 = require("../PKCS7/KeyAgreementRecipientInfo.ta"); Object.defineProperty(exports, "KeyAgreementRecipientInfo", { enumerable: true, get: function () { return KeyAgreementRecipientInfo_ta_2.KeyAgreementRecipientInfo; } }); Object.defineProperty(exports, "_decode_KeyAgreementRecipientInfo", { enumerable: true, get: function () { return KeyAgreementRecipientInfo_ta_2._decode_KeyAgreementRecipientInfo; } }); Object.defineProperty(exports, "_encode_KeyAgreementRecipientInfo", { enumerable: true, get: function () { return KeyAgreementRecipientInfo_ta_2._encode_KeyAgreementRecipientInfo; } }); var KeyEncryptionKeyRecipientInfo_ta_2 = require("../PKCS7/KeyEncryptionKeyRecipientInfo.ta"); Object.defineProperty(exports, "KeyEncryptionKeyRecipientInfo", { enumerable: true, get: function () { return KeyEncryptionKeyRecipientInfo_ta_2.KeyEncryptionKeyRecipientInfo; } }); Object.defineProperty(exports, "_decode_KeyEncryptionKeyRecipientInfo", { enumerable: true, get: function () { return KeyEncryptionKeyRecipientInfo_ta_2._decode_KeyEncryptionKeyRecipientInfo; } }); Object.defineProperty(exports, "_encode_KeyEncryptionKeyRecipientInfo", { enumerable: true, get: function () { return KeyEncryptionKeyRecipientInfo_ta_2._encode_KeyEncryptionKeyRecipientInfo; } }); var KeyTransportRecipientInfo_ta_2 = require("../PKCS7/KeyTransportRecipientInfo.ta"); Object.defineProperty(exports, "KeyTransportRecipientInfo", { enumerable: true, get: function () { return KeyTransportRecipientInfo_ta_2.KeyTransportRecipientInfo; } }); Object.defineProperty(exports, "_decode_KeyTransportRecipientInfo", { enumerable: true, get: function () { return KeyTransportRecipientInfo_ta_2._decode_KeyTransportRecipientInfo; } }); Object.defineProperty(exports, "_encode_KeyTransportRecipientInfo", { enumerable: true, get: function () { return KeyTransportRecipientInfo_ta_2._encode_KeyTransportRecipientInfo; } }); /* END_OF_SYMBOL_DEFINITION RecipientInfo */ /* START_OF_SYMBOL_DEFINITION _cached_decoder_for_RecipientInfo */ let _cached_decoder_for_RecipientInfo = null; /* END_OF_SYMBOL_DEFINITION _cached_decoder_for_RecipientInfo */ /* START_OF_SYMBOL_DEFINITION _decode_RecipientInfo */ /** * @summary Decodes an ASN.1 element into a(n) RecipientInfo * @function * @param {_Element} el The element being decoded. * @returns {RecipientInfo} The decoded data structure. */ function _decode_RecipientInfo(el) { if (!_cached_decoder_for_RecipientInfo) { _cached_decoder_for_RecipientInfo = $._decode_inextensible_choice({ "UNIVERSAL 16": [ "keyTransportRecipientInfo", KeyTransportRecipientInfo_ta_1._decode_KeyTransportRecipientInfo, ], "CONTEXT 1": [ "keyAgreementRecipientInfo", $._decode_implicit(() => KeyAgreementRecipientInfo_ta_1._decode_KeyAgreementRecipientInfo), ], "CONTEXT 2": [ "keyEncryptionKeyRecipientInfo", $._decode_implicit(() => KeyEncryptionKeyRecipientInfo_ta_1._decode_KeyEncryptionKeyRecipientInfo), ], }); } return _cached_decoder_for_RecipientInfo(el); } exports._decode_RecipientInfo = _decode_RecipientInfo; /* END_OF_SYMBOL_DEFINITION _decode_RecipientInfo */ /* START_OF_SYMBOL_DEFINITION _cached_encoder_for_RecipientInfo */ let _cached_encoder_for_RecipientInfo = null; /* END_OF_SYMBOL_DEFINITION _cached_encoder_for_RecipientInfo */ /* START_OF_SYMBOL_DEFINITION _encode_RecipientInfo */ /** * @summary Encodes a(n) RecipientInfo 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 RecipientInfo, encoded as an ASN.1 Element. */ function _encode_RecipientInfo(value, elGetter) { if (!_cached_encoder_for_RecipientInfo) { _cached_encoder_for_RecipientInfo = $._encode_choice({ keyTransportRecipientInfo: KeyTransportRecipientInfo_ta_1._encode_KeyTransportRecipientInfo, keyAgreementRecipientInfo: $._encode_implicit(asn1_ts_1.ASN1TagClass.context, 1, () => KeyAgreementRecipientInfo_ta_1._encode_KeyAgreementRecipientInfo, $.BER), keyEncryptionKeyRecipientInfo: $._encode_implicit(asn1_ts_1.ASN1TagClass.context, 2, () => KeyEncryptionKeyRecipientInfo_ta_1._encode_KeyEncryptionKeyRecipientInfo, $.BER), }, $.BER); } return _cached_encoder_for_RecipientInfo(value, elGetter); } exports._encode_RecipientInfo = _encode_RecipientInfo; /* END_OF_SYMBOL_DEFINITION _encode_RecipientInfo */ /* eslint-enable */ //# sourceMappingURL=RecipientInfo.ta.js.map