signer_info.js 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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";
  5. import { CMSVersion, SignatureAlgorithmIdentifier, DigestAlgorithmIdentifier } from "./types";
  6. import { Attribute } from "./attribute";
  7. export class SignerInfo {
  8. constructor(params = {}) {
  9. this.version = CMSVersion.v0;
  10. this.sid = new SignerIdentifier();
  11. this.digestAlgorithm = new DigestAlgorithmIdentifier();
  12. this.signatureAlgorithm = new SignatureAlgorithmIdentifier();
  13. this.signature = new OctetString();
  14. Object.assign(this, params);
  15. }
  16. }
  17. __decorate([
  18. AsnProp({ type: AsnPropTypes.Integer })
  19. ], SignerInfo.prototype, "version", void 0);
  20. __decorate([
  21. AsnProp({ type: SignerIdentifier })
  22. ], SignerInfo.prototype, "sid", void 0);
  23. __decorate([
  24. AsnProp({ type: DigestAlgorithmIdentifier })
  25. ], SignerInfo.prototype, "digestAlgorithm", void 0);
  26. __decorate([
  27. AsnProp({
  28. type: Attribute,
  29. repeated: "set",
  30. context: 0,
  31. implicit: true,
  32. optional: true,
  33. raw: true,
  34. })
  35. ], SignerInfo.prototype, "signedAttrs", void 0);
  36. __decorate([
  37. AsnProp({ type: SignatureAlgorithmIdentifier })
  38. ], SignerInfo.prototype, "signatureAlgorithm", void 0);
  39. __decorate([
  40. AsnProp({ type: OctetString })
  41. ], SignerInfo.prototype, "signature", void 0);
  42. __decorate([
  43. AsnProp({ type: Attribute, repeated: "set", context: 1, implicit: true, optional: true })
  44. ], SignerInfo.prototype, "unsignedAttrs", void 0);
  45. let SignerInfos = SignerInfos_1 = class SignerInfos extends AsnArray {
  46. constructor(items) {
  47. super(items);
  48. Object.setPrototypeOf(this, SignerInfos_1.prototype);
  49. }
  50. };
  51. SignerInfos = SignerInfos_1 = __decorate([
  52. AsnType({ type: AsnTypeTypes.Set, itemType: SignerInfo })
  53. ], SignerInfos);
  54. export { SignerInfos };