@wildboar/pkcs
Version:
Public Key Cryptography Standard PDUs in TypeScript
75 lines • 5.15 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports._encode_RecipientInfo = exports._decode_RecipientInfo = exports._encode_KeyTransRecipientInfo = exports._decode_KeyTransRecipientInfo = exports.KeyTransRecipientInfo = exports._encode_KeyAgreeRecipientInfo = exports._decode_KeyAgreeRecipientInfo = exports.KeyAgreeRecipientInfo = exports._encode_KEKRecipientInfo = exports._decode_KEKRecipientInfo = exports.KEKRecipientInfo = void 0;
/* eslint-disable */
const asn1_ts_1 = require("asn1-ts");
const $ = require("asn1-ts/dist/node/functional");
const KEKRecipientInfo_ta_1 = require("../CryptographicMessageSyntax/KEKRecipientInfo.ta");
const KeyAgreeRecipientInfo_ta_1 = require("../CryptographicMessageSyntax/KeyAgreeRecipientInfo.ta");
const KeyTransRecipientInfo_ta_1 = require("../CryptographicMessageSyntax/KeyTransRecipientInfo.ta");
var KEKRecipientInfo_ta_2 = require("../CryptographicMessageSyntax/KEKRecipientInfo.ta");
Object.defineProperty(exports, "KEKRecipientInfo", { enumerable: true, get: function () { return KEKRecipientInfo_ta_2.KEKRecipientInfo; } });
Object.defineProperty(exports, "_decode_KEKRecipientInfo", { enumerable: true, get: function () { return KEKRecipientInfo_ta_2._decode_KEKRecipientInfo; } });
Object.defineProperty(exports, "_encode_KEKRecipientInfo", { enumerable: true, get: function () { return KEKRecipientInfo_ta_2._encode_KEKRecipientInfo; } });
var KeyAgreeRecipientInfo_ta_2 = require("../CryptographicMessageSyntax/KeyAgreeRecipientInfo.ta");
Object.defineProperty(exports, "KeyAgreeRecipientInfo", { enumerable: true, get: function () { return KeyAgreeRecipientInfo_ta_2.KeyAgreeRecipientInfo; } });
Object.defineProperty(exports, "_decode_KeyAgreeRecipientInfo", { enumerable: true, get: function () { return KeyAgreeRecipientInfo_ta_2._decode_KeyAgreeRecipientInfo; } });
Object.defineProperty(exports, "_encode_KeyAgreeRecipientInfo", { enumerable: true, get: function () { return KeyAgreeRecipientInfo_ta_2._encode_KeyAgreeRecipientInfo; } });
var KeyTransRecipientInfo_ta_2 = require("../CryptographicMessageSyntax/KeyTransRecipientInfo.ta");
Object.defineProperty(exports, "KeyTransRecipientInfo", { enumerable: true, get: function () { return KeyTransRecipientInfo_ta_2.KeyTransRecipientInfo; } });
Object.defineProperty(exports, "_decode_KeyTransRecipientInfo", { enumerable: true, get: function () { return KeyTransRecipientInfo_ta_2._decode_KeyTransRecipientInfo; } });
Object.defineProperty(exports, "_encode_KeyTransRecipientInfo", { enumerable: true, get: function () { return KeyTransRecipientInfo_ta_2._encode_KeyTransRecipientInfo; } });
/* 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": ["ktri", KeyTransRecipientInfo_ta_1._decode_KeyTransRecipientInfo],
"CONTEXT 1": [
"kari",
$._decode_implicit(() => KeyAgreeRecipientInfo_ta_1._decode_KeyAgreeRecipientInfo),
],
"CONTEXT 2": [
"kekri",
$._decode_implicit(() => KEKRecipientInfo_ta_1._decode_KEKRecipientInfo),
],
});
}
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({
ktri: KeyTransRecipientInfo_ta_1._encode_KeyTransRecipientInfo,
kari: $._encode_implicit(asn1_ts_1.ASN1TagClass.context, 1, () => KeyAgreeRecipientInfo_ta_1._encode_KeyAgreeRecipientInfo, $.BER),
kekri: $._encode_implicit(asn1_ts_1.ASN1TagClass.context, 2, () => KEKRecipientInfo_ta_1._encode_KEKRecipientInfo, $.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