UNPKG

pkcs-ts

Version:

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

116 lines 9.53 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports._encode_EnvelopedData = exports._decode_EnvelopedData = exports._extension_additions_list_spec_for_EnvelopedData = exports._root_component_type_list_2_spec_for_EnvelopedData = exports._root_component_type_list_1_spec_for_EnvelopedData = exports.EnvelopedData = exports._encode_UnprotectedAttributes = exports._decode_UnprotectedAttributes = exports._encode_RecipientInfos = exports._decode_RecipientInfos = exports._encode_OriginatorInfo = exports._decode_OriginatorInfo = exports.OriginatorInfo = exports._encode_EncryptedContentInfo = exports._decode_EncryptedContentInfo = exports.EncryptedContentInfo = 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 EncryptedContentInfo_ta_1 = require("../CryptographicMessageSyntax/EncryptedContentInfo.ta"); const OriginatorInfo_ta_1 = require("../CryptographicMessageSyntax/OriginatorInfo.ta"); const RecipientInfos_ta_1 = require("../CryptographicMessageSyntax/RecipientInfos.ta"); const UnprotectedAttributes_ta_1 = require("../CryptographicMessageSyntax/UnprotectedAttributes.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 EncryptedContentInfo_ta_2 = require("../CryptographicMessageSyntax/EncryptedContentInfo.ta"); Object.defineProperty(exports, "EncryptedContentInfo", { enumerable: true, get: function () { return EncryptedContentInfo_ta_2.EncryptedContentInfo; } }); Object.defineProperty(exports, "_decode_EncryptedContentInfo", { enumerable: true, get: function () { return EncryptedContentInfo_ta_2._decode_EncryptedContentInfo; } }); Object.defineProperty(exports, "_encode_EncryptedContentInfo", { enumerable: true, get: function () { return EncryptedContentInfo_ta_2._encode_EncryptedContentInfo; } }); var OriginatorInfo_ta_2 = require("../CryptographicMessageSyntax/OriginatorInfo.ta"); Object.defineProperty(exports, "OriginatorInfo", { enumerable: true, get: function () { return OriginatorInfo_ta_2.OriginatorInfo; } }); Object.defineProperty(exports, "_decode_OriginatorInfo", { enumerable: true, get: function () { return OriginatorInfo_ta_2._decode_OriginatorInfo; } }); Object.defineProperty(exports, "_encode_OriginatorInfo", { enumerable: true, get: function () { return OriginatorInfo_ta_2._encode_OriginatorInfo; } }); var RecipientInfos_ta_2 = require("../CryptographicMessageSyntax/RecipientInfos.ta"); Object.defineProperty(exports, "_decode_RecipientInfos", { enumerable: true, get: function () { return RecipientInfos_ta_2._decode_RecipientInfos; } }); Object.defineProperty(exports, "_encode_RecipientInfos", { enumerable: true, get: function () { return RecipientInfos_ta_2._encode_RecipientInfos; } }); var UnprotectedAttributes_ta_2 = require("../CryptographicMessageSyntax/UnprotectedAttributes.ta"); Object.defineProperty(exports, "_decode_UnprotectedAttributes", { enumerable: true, get: function () { return UnprotectedAttributes_ta_2._decode_UnprotectedAttributes; } }); Object.defineProperty(exports, "_encode_UnprotectedAttributes", { enumerable: true, get: function () { return UnprotectedAttributes_ta_2._encode_UnprotectedAttributes; } }); class EnvelopedData { constructor(version, originatorInfo, recipientInfos, encryptedContentInfo, unprotectedAttrs) { this.version = version; this.originatorInfo = originatorInfo; this.recipientInfos = recipientInfos; this.encryptedContentInfo = encryptedContentInfo; this.unprotectedAttrs = unprotectedAttrs; } static _from_object(_o) { return new EnvelopedData(_o.version, _o.originatorInfo, _o.recipientInfos, _o.encryptedContentInfo, _o.unprotectedAttrs); } } exports.EnvelopedData = EnvelopedData; exports._root_component_type_list_1_spec_for_EnvelopedData = [ new $.ComponentSpec("version", false, $.hasTag(asn1_ts_1.ASN1TagClass.universal, 2), undefined, undefined), new $.ComponentSpec("originatorInfo", true, $.hasTag(asn1_ts_1.ASN1TagClass.context, 0), undefined, undefined), new $.ComponentSpec("recipientInfos", false, $.hasTag(asn1_ts_1.ASN1TagClass.universal, 17), undefined, undefined), new $.ComponentSpec("encryptedContentInfo", false, $.hasTag(asn1_ts_1.ASN1TagClass.universal, 16), undefined, undefined), new $.ComponentSpec("unprotectedAttrs", true, $.hasTag(asn1_ts_1.ASN1TagClass.context, 1), undefined, undefined), ]; exports._root_component_type_list_2_spec_for_EnvelopedData = []; exports._extension_additions_list_spec_for_EnvelopedData = []; let _cached_decoder_for_EnvelopedData = null; function _decode_EnvelopedData(el) { if (!_cached_decoder_for_EnvelopedData) { _cached_decoder_for_EnvelopedData = function (el) { let version; let originatorInfo; let recipientInfos; let encryptedContentInfo; let unprotectedAttrs; const callbacks = { version: (_el) => { version = CMSVersion_ta_1._decode_CMSVersion(_el); }, originatorInfo: (_el) => { originatorInfo = $._decode_implicit(() => OriginatorInfo_ta_1._decode_OriginatorInfo)(_el); }, recipientInfos: (_el) => { recipientInfos = RecipientInfos_ta_1._decode_RecipientInfos(_el); }, encryptedContentInfo: (_el) => { encryptedContentInfo = EncryptedContentInfo_ta_1._decode_EncryptedContentInfo(_el); }, unprotectedAttrs: (_el) => { unprotectedAttrs = $._decode_implicit(() => UnprotectedAttributes_ta_1._decode_UnprotectedAttributes)(_el); }, }; $._parse_sequence(el, callbacks, exports._root_component_type_list_1_spec_for_EnvelopedData, exports._extension_additions_list_spec_for_EnvelopedData, exports._root_component_type_list_2_spec_for_EnvelopedData, undefined); return new EnvelopedData(version, originatorInfo, recipientInfos, encryptedContentInfo, unprotectedAttrs); }; } return _cached_decoder_for_EnvelopedData(el); } exports._decode_EnvelopedData = _decode_EnvelopedData; let _cached_encoder_for_EnvelopedData = null; function _encode_EnvelopedData(value, elGetter) { if (!_cached_encoder_for_EnvelopedData) { _cached_encoder_for_EnvelopedData = function (value, elGetter) { return $._encodeSequence([] .concat([ CMSVersion_ta_1._encode_CMSVersion(value.version, $.BER), value.originatorInfo === undefined ? undefined : $._encode_implicit(asn1_ts_1.ASN1TagClass.context, 0, () => OriginatorInfo_ta_1._encode_OriginatorInfo, $.BER)(value.originatorInfo, $.BER), RecipientInfos_ta_1._encode_RecipientInfos(value.recipientInfos, $.BER), EncryptedContentInfo_ta_1._encode_EncryptedContentInfo(value.encryptedContentInfo, $.BER), value.unprotectedAttrs === undefined ? undefined : $._encode_implicit(asn1_ts_1.ASN1TagClass.context, 1, () => UnprotectedAttributes_ta_1._encode_UnprotectedAttributes, $.BER)(value.unprotectedAttrs, $.BER), ]) .filter((c) => !!c), $.BER); }; } return _cached_encoder_for_EnvelopedData(value, elGetter); } exports._encode_EnvelopedData = _encode_EnvelopedData; //# sourceMappingURL=EnvelopedData.ta.js.map