UNPKG

pkcs-ts

Version:

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

112 lines 9.71 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports._encode_KeyAgreeRecipientInfo = exports._decode_KeyAgreeRecipientInfo = exports._extension_additions_list_spec_for_KeyAgreeRecipientInfo = exports._root_component_type_list_2_spec_for_KeyAgreeRecipientInfo = exports._root_component_type_list_1_spec_for_KeyAgreeRecipientInfo = exports.KeyAgreeRecipientInfo = exports._encode_UserKeyingMaterial = exports._decode_UserKeyingMaterial = exports._encode_RecipientEncryptedKeys = exports._decode_RecipientEncryptedKeys = exports._encode_OriginatorIdentifierOrKey = exports._decode_OriginatorIdentifierOrKey = exports._encode_KeyEncryptionAlgorithmIdentifier = exports._decode_KeyEncryptionAlgorithmIdentifier = exports._encode_CMSVersion = exports._decode_CMSVersion = exports.v4 = exports.v3 = exports.v2 = exports.v1 = exports.v0 = exports.CMSVersion_v4 = exports.CMSVersion_v3 = exports.CMSVersion_v2 = exports.CMSVersion_v1 = exports.CMSVersion_v0 = 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 CMSVersion_ta_1 = require("../CryptographicMessageSyntax/CMSVersion.ta"); const KeyEncryptionAlgorithmIdentifier_ta_1 = require("../CryptographicMessageSyntax/KeyEncryptionAlgorithmIdentifier.ta"); const OriginatorIdentifierOrKey_ta_1 = require("../CryptographicMessageSyntax/OriginatorIdentifierOrKey.ta"); const RecipientEncryptedKeys_ta_1 = require("../CryptographicMessageSyntax/RecipientEncryptedKeys.ta"); const UserKeyingMaterial_ta_1 = require("../CryptographicMessageSyntax/UserKeyingMaterial.ta"); var CMSVersion_ta_2 = require("../CryptographicMessageSyntax/CMSVersion.ta"); Object.defineProperty(exports, "CMSVersion_v0", { enumerable: true, get: function () { return CMSVersion_ta_2.CMSVersion_v0; } }); Object.defineProperty(exports, "CMSVersion_v1", { enumerable: true, get: function () { return CMSVersion_ta_2.CMSVersion_v1; } }); Object.defineProperty(exports, "CMSVersion_v2", { enumerable: true, get: function () { return CMSVersion_ta_2.CMSVersion_v2; } }); Object.defineProperty(exports, "CMSVersion_v3", { enumerable: true, get: function () { return CMSVersion_ta_2.CMSVersion_v3; } }); Object.defineProperty(exports, "CMSVersion_v4", { enumerable: true, get: function () { return CMSVersion_ta_2.CMSVersion_v4; } }); Object.defineProperty(exports, "v0", { enumerable: true, get: function () { return CMSVersion_ta_2.v0; } }); Object.defineProperty(exports, "v1", { enumerable: true, get: function () { return CMSVersion_ta_2.v1; } }); Object.defineProperty(exports, "v2", { enumerable: true, get: function () { return CMSVersion_ta_2.v2; } }); Object.defineProperty(exports, "v3", { enumerable: true, get: function () { return CMSVersion_ta_2.v3; } }); Object.defineProperty(exports, "v4", { enumerable: true, get: function () { return CMSVersion_ta_2.v4; } }); Object.defineProperty(exports, "_decode_CMSVersion", { enumerable: true, get: function () { return CMSVersion_ta_2._decode_CMSVersion; } }); Object.defineProperty(exports, "_encode_CMSVersion", { enumerable: true, get: function () { return CMSVersion_ta_2._encode_CMSVersion; } }); var KeyEncryptionAlgorithmIdentifier_ta_2 = require("../CryptographicMessageSyntax/KeyEncryptionAlgorithmIdentifier.ta"); Object.defineProperty(exports, "_decode_KeyEncryptionAlgorithmIdentifier", { enumerable: true, get: function () { return KeyEncryptionAlgorithmIdentifier_ta_2._decode_KeyEncryptionAlgorithmIdentifier; } }); Object.defineProperty(exports, "_encode_KeyEncryptionAlgorithmIdentifier", { enumerable: true, get: function () { return KeyEncryptionAlgorithmIdentifier_ta_2._encode_KeyEncryptionAlgorithmIdentifier; } }); var OriginatorIdentifierOrKey_ta_2 = require("../CryptographicMessageSyntax/OriginatorIdentifierOrKey.ta"); Object.defineProperty(exports, "_decode_OriginatorIdentifierOrKey", { enumerable: true, get: function () { return OriginatorIdentifierOrKey_ta_2._decode_OriginatorIdentifierOrKey; } }); Object.defineProperty(exports, "_encode_OriginatorIdentifierOrKey", { enumerable: true, get: function () { return OriginatorIdentifierOrKey_ta_2._encode_OriginatorIdentifierOrKey; } }); var RecipientEncryptedKeys_ta_2 = require("../CryptographicMessageSyntax/RecipientEncryptedKeys.ta"); Object.defineProperty(exports, "_decode_RecipientEncryptedKeys", { enumerable: true, get: function () { return RecipientEncryptedKeys_ta_2._decode_RecipientEncryptedKeys; } }); Object.defineProperty(exports, "_encode_RecipientEncryptedKeys", { enumerable: true, get: function () { return RecipientEncryptedKeys_ta_2._encode_RecipientEncryptedKeys; } }); var UserKeyingMaterial_ta_2 = require("../CryptographicMessageSyntax/UserKeyingMaterial.ta"); Object.defineProperty(exports, "_decode_UserKeyingMaterial", { enumerable: true, get: function () { return UserKeyingMaterial_ta_2._decode_UserKeyingMaterial; } }); Object.defineProperty(exports, "_encode_UserKeyingMaterial", { enumerable: true, get: function () { return UserKeyingMaterial_ta_2._encode_UserKeyingMaterial; } }); class KeyAgreeRecipientInfo { constructor(version, originator, ukm, keyEncryptionAlgorithm, recipientEncryptedKeys) { this.version = version; this.originator = originator; this.ukm = ukm; this.keyEncryptionAlgorithm = keyEncryptionAlgorithm; this.recipientEncryptedKeys = recipientEncryptedKeys; } static _from_object(_o) { return new KeyAgreeRecipientInfo(_o.version, _o.originator, _o.ukm, _o.keyEncryptionAlgorithm, _o.recipientEncryptedKeys); } } exports.KeyAgreeRecipientInfo = KeyAgreeRecipientInfo; exports._root_component_type_list_1_spec_for_KeyAgreeRecipientInfo = [ new $.ComponentSpec("version", false, $.hasTag(asn1_ts_1.ASN1TagClass.universal, 2), undefined, undefined), new $.ComponentSpec("originator", false, $.hasTag(asn1_ts_1.ASN1TagClass.context, 0), undefined, undefined), new $.ComponentSpec("ukm", true, $.hasTag(asn1_ts_1.ASN1TagClass.context, 1), undefined, undefined), new $.ComponentSpec("keyEncryptionAlgorithm", false, $.hasTag(asn1_ts_1.ASN1TagClass.universal, 16), undefined, undefined), new $.ComponentSpec("recipientEncryptedKeys", false, $.hasTag(asn1_ts_1.ASN1TagClass.universal, 16), undefined, undefined), ]; exports._root_component_type_list_2_spec_for_KeyAgreeRecipientInfo = []; exports._extension_additions_list_spec_for_KeyAgreeRecipientInfo = []; let _cached_decoder_for_KeyAgreeRecipientInfo = null; function _decode_KeyAgreeRecipientInfo(el) { if (!_cached_decoder_for_KeyAgreeRecipientInfo) { _cached_decoder_for_KeyAgreeRecipientInfo = function (el) { let version; let originator; let ukm; let keyEncryptionAlgorithm; let recipientEncryptedKeys; const callbacks = { version: (_el) => { version = CMSVersion_ta_1._decode_CMSVersion(_el); }, originator: (_el) => { originator = $._decode_explicit(() => OriginatorIdentifierOrKey_ta_1._decode_OriginatorIdentifierOrKey)(_el); }, ukm: (_el) => { ukm = $._decode_explicit(() => UserKeyingMaterial_ta_1._decode_UserKeyingMaterial)(_el); }, keyEncryptionAlgorithm: (_el) => { keyEncryptionAlgorithm = KeyEncryptionAlgorithmIdentifier_ta_1._decode_KeyEncryptionAlgorithmIdentifier(_el); }, recipientEncryptedKeys: (_el) => { recipientEncryptedKeys = RecipientEncryptedKeys_ta_1._decode_RecipientEncryptedKeys(_el); }, }; $._parse_sequence(el, callbacks, exports._root_component_type_list_1_spec_for_KeyAgreeRecipientInfo, exports._extension_additions_list_spec_for_KeyAgreeRecipientInfo, exports._root_component_type_list_2_spec_for_KeyAgreeRecipientInfo, undefined); return new KeyAgreeRecipientInfo(version, originator, ukm, keyEncryptionAlgorithm, recipientEncryptedKeys); }; } return _cached_decoder_for_KeyAgreeRecipientInfo(el); } exports._decode_KeyAgreeRecipientInfo = _decode_KeyAgreeRecipientInfo; let _cached_encoder_for_KeyAgreeRecipientInfo = null; function _encode_KeyAgreeRecipientInfo(value, elGetter) { if (!_cached_encoder_for_KeyAgreeRecipientInfo) { _cached_encoder_for_KeyAgreeRecipientInfo = function (value, elGetter) { return $._encodeSequence([] .concat([ CMSVersion_ta_1._encode_CMSVersion(value.version, $.BER), $._encode_explicit(asn1_ts_1.ASN1TagClass.context, 0, () => OriginatorIdentifierOrKey_ta_1._encode_OriginatorIdentifierOrKey, $.BER)(value.originator, $.BER), value.ukm === undefined ? undefined : $._encode_explicit(asn1_ts_1.ASN1TagClass.context, 1, () => UserKeyingMaterial_ta_1._encode_UserKeyingMaterial, $.BER)(value.ukm, $.BER), KeyEncryptionAlgorithmIdentifier_ta_1._encode_KeyEncryptionAlgorithmIdentifier(value.keyEncryptionAlgorithm, $.BER), RecipientEncryptedKeys_ta_1._encode_RecipientEncryptedKeys(value.recipientEncryptedKeys, $.BER), ]) .filter((c) => !!c), $.BER); }; } return _cached_encoder_for_KeyAgreeRecipientInfo(value, elGetter); } exports._encode_KeyAgreeRecipientInfo = _encode_KeyAgreeRecipientInfo; //# sourceMappingURL=KeyAgreeRecipientInfo.ta.js.map