enveloped_data.js 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. "use strict";
  2. var UnprotectedAttributes_1;
  3. Object.defineProperty(exports, "__esModule", { value: true });
  4. exports.EnvelopedData = exports.UnprotectedAttributes = void 0;
  5. const tslib_1 = require("tslib");
  6. const asn1_schema_1 = require("@peculiar/asn1-schema");
  7. const types_1 = require("./types");
  8. const attribute_1 = require("./attribute");
  9. const recipient_infos_1 = require("./recipient_infos");
  10. const originator_info_1 = require("./originator_info");
  11. const encrypted_content_info_1 = require("./encrypted_content_info");
  12. let UnprotectedAttributes = UnprotectedAttributes_1 = class UnprotectedAttributes extends asn1_schema_1.AsnArray {
  13. constructor(items) {
  14. super(items);
  15. Object.setPrototypeOf(this, UnprotectedAttributes_1.prototype);
  16. }
  17. };
  18. exports.UnprotectedAttributes = UnprotectedAttributes;
  19. exports.UnprotectedAttributes = UnprotectedAttributes = UnprotectedAttributes_1 = tslib_1.__decorate([
  20. (0, asn1_schema_1.AsnType)({ type: asn1_schema_1.AsnTypeTypes.Set, itemType: attribute_1.Attribute })
  21. ], UnprotectedAttributes);
  22. class EnvelopedData {
  23. constructor(params = {}) {
  24. this.version = types_1.CMSVersion.v0;
  25. this.recipientInfos = new recipient_infos_1.RecipientInfos();
  26. this.encryptedContentInfo = new encrypted_content_info_1.EncryptedContentInfo();
  27. Object.assign(this, params);
  28. }
  29. }
  30. exports.EnvelopedData = EnvelopedData;
  31. tslib_1.__decorate([
  32. (0, asn1_schema_1.AsnProp)({ type: asn1_schema_1.AsnPropTypes.Integer })
  33. ], EnvelopedData.prototype, "version", void 0);
  34. tslib_1.__decorate([
  35. (0, asn1_schema_1.AsnProp)({ type: originator_info_1.OriginatorInfo, context: 0, implicit: true, optional: true })
  36. ], EnvelopedData.prototype, "originatorInfo", void 0);
  37. tslib_1.__decorate([
  38. (0, asn1_schema_1.AsnProp)({ type: recipient_infos_1.RecipientInfos })
  39. ], EnvelopedData.prototype, "recipientInfos", void 0);
  40. tslib_1.__decorate([
  41. (0, asn1_schema_1.AsnProp)({ type: encrypted_content_info_1.EncryptedContentInfo })
  42. ], EnvelopedData.prototype, "encryptedContentInfo", void 0);
  43. tslib_1.__decorate([
  44. (0, asn1_schema_1.AsnProp)({ type: UnprotectedAttributes, context: 1, implicit: true, optional: true })
  45. ], EnvelopedData.prototype, "unprotectedAttrs", void 0);