UNPKG

pkcs-ts

Version:

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

68 lines 4.35 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports._encode_RecipientEncryptedKey = exports._decode_RecipientEncryptedKey = exports._extension_additions_list_spec_for_RecipientEncryptedKey = exports._root_component_type_list_2_spec_for_RecipientEncryptedKey = exports._root_component_type_list_1_spec_for_RecipientEncryptedKey = exports.RecipientEncryptedKey = exports._encode_KeyAgreeRecipientIdentifier = exports._decode_KeyAgreeRecipientIdentifier = exports._encode_EncryptedKey = exports._decode_EncryptedKey = 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 EncryptedKey_ta_1 = require("../CryptographicMessageSyntax/EncryptedKey.ta"); const KeyAgreeRecipientIdentifier_ta_1 = require("../CryptographicMessageSyntax/KeyAgreeRecipientIdentifier.ta"); var EncryptedKey_ta_2 = require("../CryptographicMessageSyntax/EncryptedKey.ta"); Object.defineProperty(exports, "_decode_EncryptedKey", { enumerable: true, get: function () { return EncryptedKey_ta_2._decode_EncryptedKey; } }); Object.defineProperty(exports, "_encode_EncryptedKey", { enumerable: true, get: function () { return EncryptedKey_ta_2._encode_EncryptedKey; } }); var KeyAgreeRecipientIdentifier_ta_2 = require("../CryptographicMessageSyntax/KeyAgreeRecipientIdentifier.ta"); Object.defineProperty(exports, "_decode_KeyAgreeRecipientIdentifier", { enumerable: true, get: function () { return KeyAgreeRecipientIdentifier_ta_2._decode_KeyAgreeRecipientIdentifier; } }); Object.defineProperty(exports, "_encode_KeyAgreeRecipientIdentifier", { enumerable: true, get: function () { return KeyAgreeRecipientIdentifier_ta_2._encode_KeyAgreeRecipientIdentifier; } }); class RecipientEncryptedKey { constructor(rid, encryptedKey) { this.rid = rid; this.encryptedKey = encryptedKey; } static _from_object(_o) { return new RecipientEncryptedKey(_o.rid, _o.encryptedKey); } } exports.RecipientEncryptedKey = RecipientEncryptedKey; exports._root_component_type_list_1_spec_for_RecipientEncryptedKey = [ new $.ComponentSpec("rid", false, $.hasAnyTag, undefined, undefined), new $.ComponentSpec("encryptedKey", false, $.hasTag(asn1_ts_1.ASN1TagClass.universal, 4), undefined, undefined), ]; exports._root_component_type_list_2_spec_for_RecipientEncryptedKey = []; exports._extension_additions_list_spec_for_RecipientEncryptedKey = []; let _cached_decoder_for_RecipientEncryptedKey = null; function _decode_RecipientEncryptedKey(el) { if (!_cached_decoder_for_RecipientEncryptedKey) { _cached_decoder_for_RecipientEncryptedKey = function (el) { const sequence = el.sequence; if (sequence.length < 2) { throw new asn1_ts_1.ASN1ConstructionError("RecipientEncryptedKey contained only " + sequence.length.toString() + " elements."); } sequence[0].name = "rid"; sequence[1].name = "encryptedKey"; let rid; let encryptedKey; rid = KeyAgreeRecipientIdentifier_ta_1._decode_KeyAgreeRecipientIdentifier(sequence[0]); encryptedKey = EncryptedKey_ta_1._decode_EncryptedKey(sequence[1]); return new RecipientEncryptedKey(rid, encryptedKey); }; } return _cached_decoder_for_RecipientEncryptedKey(el); } exports._decode_RecipientEncryptedKey = _decode_RecipientEncryptedKey; let _cached_encoder_for_RecipientEncryptedKey = null; function _encode_RecipientEncryptedKey(value, elGetter) { if (!_cached_encoder_for_RecipientEncryptedKey) { _cached_encoder_for_RecipientEncryptedKey = function (value, elGetter) { return $._encodeSequence([] .concat([ KeyAgreeRecipientIdentifier_ta_1._encode_KeyAgreeRecipientIdentifier(value.rid, $.BER), EncryptedKey_ta_1._encode_EncryptedKey(value.encryptedKey, $.BER), ]) .filter((c) => !!c), $.BER); }; } return _cached_encoder_for_RecipientEncryptedKey(value, elGetter); } exports._encode_RecipientEncryptedKey = _encode_RecipientEncryptedKey; //# sourceMappingURL=RecipientEncryptedKey.ta.js.map