signed_data.js 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. var DigestAlgorithmIdentifiers_1;
  2. import { __decorate } from "tslib";
  3. import { AsnProp, AsnPropTypes, AsnArray, AsnType, AsnTypeTypes } from "@peculiar/asn1-schema";
  4. import { CertificateSet } from "./certificate_choices";
  5. import { CMSVersion, DigestAlgorithmIdentifier } from "./types";
  6. import { EncapsulatedContentInfo } from "./encapsulated_content_info";
  7. import { RevocationInfoChoices } from "./revocation_info_choice";
  8. import { SignerInfos } from "./signer_info";
  9. let DigestAlgorithmIdentifiers = DigestAlgorithmIdentifiers_1 = class DigestAlgorithmIdentifiers extends AsnArray {
  10. constructor(items) {
  11. super(items);
  12. Object.setPrototypeOf(this, DigestAlgorithmIdentifiers_1.prototype);
  13. }
  14. };
  15. DigestAlgorithmIdentifiers = DigestAlgorithmIdentifiers_1 = __decorate([
  16. AsnType({ type: AsnTypeTypes.Set, itemType: DigestAlgorithmIdentifier })
  17. ], DigestAlgorithmIdentifiers);
  18. export { DigestAlgorithmIdentifiers };
  19. export class SignedData {
  20. constructor(params = {}) {
  21. this.version = CMSVersion.v0;
  22. this.digestAlgorithms = new DigestAlgorithmIdentifiers();
  23. this.encapContentInfo = new EncapsulatedContentInfo();
  24. this.signerInfos = new SignerInfos();
  25. Object.assign(this, params);
  26. }
  27. }
  28. __decorate([
  29. AsnProp({ type: AsnPropTypes.Integer })
  30. ], SignedData.prototype, "version", void 0);
  31. __decorate([
  32. AsnProp({ type: DigestAlgorithmIdentifiers })
  33. ], SignedData.prototype, "digestAlgorithms", void 0);
  34. __decorate([
  35. AsnProp({ type: EncapsulatedContentInfo })
  36. ], SignedData.prototype, "encapContentInfo", void 0);
  37. __decorate([
  38. AsnProp({ type: CertificateSet, context: 0, implicit: true, optional: true })
  39. ], SignedData.prototype, "certificates", void 0);
  40. __decorate([
  41. AsnProp({ type: RevocationInfoChoices, context: 1, implicit: true, optional: true })
  42. ], SignedData.prototype, "crls", void 0);
  43. __decorate([
  44. AsnProp({ type: SignerInfos })
  45. ], SignedData.prototype, "signerInfos", void 0);