general_name.js 3.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. exports.GeneralName = exports.EDIPartyName = exports.OtherName = exports.AsnIpConverter = void 0;
  4. const tslib_1 = require("tslib");
  5. const asn1_schema_1 = require("@peculiar/asn1-schema");
  6. const ip_converter_1 = require("./ip_converter");
  7. const name_1 = require("./name");
  8. exports.AsnIpConverter = {
  9. fromASN: (value) => ip_converter_1.IpConverter.toString(asn1_schema_1.AsnOctetStringConverter.fromASN(value)),
  10. toASN: (value) => asn1_schema_1.AsnOctetStringConverter.toASN(ip_converter_1.IpConverter.fromString(value)),
  11. };
  12. class OtherName {
  13. constructor(params = {}) {
  14. this.typeId = "";
  15. this.value = new ArrayBuffer(0);
  16. Object.assign(this, params);
  17. }
  18. }
  19. exports.OtherName = OtherName;
  20. tslib_1.__decorate([
  21. (0, asn1_schema_1.AsnProp)({ type: asn1_schema_1.AsnPropTypes.ObjectIdentifier })
  22. ], OtherName.prototype, "typeId", void 0);
  23. tslib_1.__decorate([
  24. (0, asn1_schema_1.AsnProp)({ type: asn1_schema_1.AsnPropTypes.Any, context: 0 })
  25. ], OtherName.prototype, "value", void 0);
  26. class EDIPartyName {
  27. constructor(params = {}) {
  28. this.partyName = new name_1.DirectoryString();
  29. Object.assign(this, params);
  30. }
  31. }
  32. exports.EDIPartyName = EDIPartyName;
  33. tslib_1.__decorate([
  34. (0, asn1_schema_1.AsnProp)({ type: name_1.DirectoryString, optional: true, context: 0, implicit: true })
  35. ], EDIPartyName.prototype, "nameAssigner", void 0);
  36. tslib_1.__decorate([
  37. (0, asn1_schema_1.AsnProp)({ type: name_1.DirectoryString, context: 1, implicit: true })
  38. ], EDIPartyName.prototype, "partyName", void 0);
  39. let GeneralName = class GeneralName {
  40. constructor(params = {}) {
  41. Object.assign(this, params);
  42. }
  43. };
  44. exports.GeneralName = GeneralName;
  45. tslib_1.__decorate([
  46. (0, asn1_schema_1.AsnProp)({ type: OtherName, context: 0, implicit: true })
  47. ], GeneralName.prototype, "otherName", void 0);
  48. tslib_1.__decorate([
  49. (0, asn1_schema_1.AsnProp)({ type: asn1_schema_1.AsnPropTypes.IA5String, context: 1, implicit: true })
  50. ], GeneralName.prototype, "rfc822Name", void 0);
  51. tslib_1.__decorate([
  52. (0, asn1_schema_1.AsnProp)({ type: asn1_schema_1.AsnPropTypes.IA5String, context: 2, implicit: true })
  53. ], GeneralName.prototype, "dNSName", void 0);
  54. tslib_1.__decorate([
  55. (0, asn1_schema_1.AsnProp)({ type: asn1_schema_1.AsnPropTypes.Any, context: 3, implicit: true })
  56. ], GeneralName.prototype, "x400Address", void 0);
  57. tslib_1.__decorate([
  58. (0, asn1_schema_1.AsnProp)({ type: name_1.Name, context: 4, implicit: false })
  59. ], GeneralName.prototype, "directoryName", void 0);
  60. tslib_1.__decorate([
  61. (0, asn1_schema_1.AsnProp)({ type: EDIPartyName, context: 5 })
  62. ], GeneralName.prototype, "ediPartyName", void 0);
  63. tslib_1.__decorate([
  64. (0, asn1_schema_1.AsnProp)({ type: asn1_schema_1.AsnPropTypes.IA5String, context: 6, implicit: true })
  65. ], GeneralName.prototype, "uniformResourceIdentifier", void 0);
  66. tslib_1.__decorate([
  67. (0, asn1_schema_1.AsnProp)({
  68. type: asn1_schema_1.AsnPropTypes.OctetString,
  69. context: 7,
  70. implicit: true,
  71. converter: exports.AsnIpConverter,
  72. })
  73. ], GeneralName.prototype, "iPAddress", void 0);
  74. tslib_1.__decorate([
  75. (0, asn1_schema_1.AsnProp)({ type: asn1_schema_1.AsnPropTypes.ObjectIdentifier, context: 8, implicit: true })
  76. ], GeneralName.prototype, "registeredID", void 0);
  77. exports.GeneralName = GeneralName = tslib_1.__decorate([
  78. (0, asn1_schema_1.AsnType)({ type: asn1_schema_1.AsnTypeTypes.Choice })
  79. ], GeneralName);