signer_info.js 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. "use strict";
  2. var SignerInfos_1;
  3. Object.defineProperty(exports, "__esModule", { value: true });
  4. exports.SignerInfos = exports.SignerInfo = void 0;
  5. const tslib_1 = require("tslib");
  6. const asn1_schema_1 = require("@peculiar/asn1-schema");
  7. const signer_identifier_1 = require("./signer_identifier");
  8. const types_1 = require("./types");
  9. const attribute_1 = require("./attribute");
  10. class SignerInfo {
  11. constructor(params = {}) {
  12. this.version = types_1.CMSVersion.v0;
  13. this.sid = new signer_identifier_1.SignerIdentifier();
  14. this.digestAlgorithm = new types_1.DigestAlgorithmIdentifier();
  15. this.signatureAlgorithm = new types_1.SignatureAlgorithmIdentifier();
  16. this.signature = new asn1_schema_1.OctetString();
  17. Object.assign(this, params);
  18. }
  19. }
  20. exports.SignerInfo = SignerInfo;
  21. tslib_1.__decorate([
  22. (0, asn1_schema_1.AsnProp)({ type: asn1_schema_1.AsnPropTypes.Integer })
  23. ], SignerInfo.prototype, "version", void 0);
  24. tslib_1.__decorate([
  25. (0, asn1_schema_1.AsnProp)({ type: signer_identifier_1.SignerIdentifier })
  26. ], SignerInfo.prototype, "sid", void 0);
  27. tslib_1.__decorate([
  28. (0, asn1_schema_1.AsnProp)({ type: types_1.DigestAlgorithmIdentifier })
  29. ], SignerInfo.prototype, "digestAlgorithm", void 0);
  30. tslib_1.__decorate([
  31. (0, asn1_schema_1.AsnProp)({
  32. type: attribute_1.Attribute,
  33. repeated: "set",
  34. context: 0,
  35. implicit: true,
  36. optional: true,
  37. raw: true,
  38. })
  39. ], SignerInfo.prototype, "signedAttrs", void 0);
  40. tslib_1.__decorate([
  41. (0, asn1_schema_1.AsnProp)({ type: types_1.SignatureAlgorithmIdentifier })
  42. ], SignerInfo.prototype, "signatureAlgorithm", void 0);
  43. tslib_1.__decorate([
  44. (0, asn1_schema_1.AsnProp)({ type: asn1_schema_1.OctetString })
  45. ], SignerInfo.prototype, "signature", void 0);
  46. tslib_1.__decorate([
  47. (0, asn1_schema_1.AsnProp)({ type: attribute_1.Attribute, repeated: "set", context: 1, implicit: true, optional: true })
  48. ], SignerInfo.prototype, "unsignedAttrs", void 0);
  49. let SignerInfos = SignerInfos_1 = class SignerInfos extends asn1_schema_1.AsnArray {
  50. constructor(items) {
  51. super(items);
  52. Object.setPrototypeOf(this, SignerInfos_1.prototype);
  53. }
  54. };
  55. exports.SignerInfos = SignerInfos;
  56. exports.SignerInfos = SignerInfos = SignerInfos_1 = tslib_1.__decorate([
  57. (0, asn1_schema_1.AsnType)({ type: asn1_schema_1.AsnTypeTypes.Set, itemType: SignerInfo })
  58. ], SignerInfos);