signer_info.js 2.0 KB

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