tbs_certificate.js 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. import { __decorate } from "tslib";
  2. import { AsnProp, AsnPropTypes, AsnIntegerArrayBufferConverter, } from "@peculiar/asn1-schema";
  3. import { AlgorithmIdentifier } from "./algorithm_identifier.js";
  4. import { Name } from "./name.js";
  5. import { SubjectPublicKeyInfo } from "./subject_public_key_info.js";
  6. import { Validity } from "./validity.js";
  7. import { Extensions } from "./extension.js";
  8. import { Version, } from "./types.js";
  9. export class TBSCertificate {
  10. version = Version.v1;
  11. serialNumber = new ArrayBuffer(0);
  12. signature = new AlgorithmIdentifier();
  13. issuer = new Name();
  14. validity = new Validity();
  15. subject = new Name();
  16. subjectPublicKeyInfo = new SubjectPublicKeyInfo();
  17. issuerUniqueID;
  18. subjectUniqueID;
  19. extensions;
  20. constructor(params = {}) {
  21. Object.assign(this, params);
  22. }
  23. }
  24. __decorate([
  25. AsnProp({
  26. type: AsnPropTypes.Integer,
  27. context: 0,
  28. defaultValue: Version.v1,
  29. })
  30. ], TBSCertificate.prototype, "version", void 0);
  31. __decorate([
  32. AsnProp({
  33. type: AsnPropTypes.Integer,
  34. converter: AsnIntegerArrayBufferConverter,
  35. })
  36. ], TBSCertificate.prototype, "serialNumber", void 0);
  37. __decorate([
  38. AsnProp({ type: AlgorithmIdentifier })
  39. ], TBSCertificate.prototype, "signature", void 0);
  40. __decorate([
  41. AsnProp({ type: Name })
  42. ], TBSCertificate.prototype, "issuer", void 0);
  43. __decorate([
  44. AsnProp({ type: Validity })
  45. ], TBSCertificate.prototype, "validity", void 0);
  46. __decorate([
  47. AsnProp({ type: Name })
  48. ], TBSCertificate.prototype, "subject", void 0);
  49. __decorate([
  50. AsnProp({ type: SubjectPublicKeyInfo })
  51. ], TBSCertificate.prototype, "subjectPublicKeyInfo", void 0);
  52. __decorate([
  53. AsnProp({
  54. type: AsnPropTypes.BitString,
  55. context: 1,
  56. implicit: true,
  57. optional: true,
  58. })
  59. ], TBSCertificate.prototype, "issuerUniqueID", void 0);
  60. __decorate([
  61. AsnProp({
  62. type: AsnPropTypes.BitString, context: 2, implicit: true, optional: true,
  63. })
  64. ], TBSCertificate.prototype, "subjectUniqueID", void 0);
  65. __decorate([
  66. AsnProp({
  67. type: Extensions, context: 3, optional: true,
  68. })
  69. ], TBSCertificate.prototype, "extensions", void 0);