general_name.js 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  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. typeId = "";
  14. value = new ArrayBuffer(0);
  15. constructor(params = {}) {
  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)({
  25. type: asn1_schema_1.AsnPropTypes.Any, context: 0,
  26. })
  27. ], OtherName.prototype, "value", void 0);
  28. class EDIPartyName {
  29. nameAssigner;
  30. partyName = new name_1.DirectoryString();
  31. constructor(params = {}) {
  32. Object.assign(this, params);
  33. }
  34. }
  35. exports.EDIPartyName = EDIPartyName;
  36. tslib_1.__decorate([
  37. (0, asn1_schema_1.AsnProp)({
  38. type: name_1.DirectoryString, optional: true, context: 0, implicit: true,
  39. })
  40. ], EDIPartyName.prototype, "nameAssigner", void 0);
  41. tslib_1.__decorate([
  42. (0, asn1_schema_1.AsnProp)({
  43. type: name_1.DirectoryString, context: 1, implicit: true,
  44. })
  45. ], EDIPartyName.prototype, "partyName", void 0);
  46. let GeneralName = class GeneralName {
  47. otherName;
  48. rfc822Name;
  49. dNSName;
  50. x400Address;
  51. directoryName;
  52. ediPartyName;
  53. uniformResourceIdentifier;
  54. iPAddress;
  55. registeredID;
  56. constructor(params = {}) {
  57. Object.assign(this, params);
  58. }
  59. };
  60. exports.GeneralName = GeneralName;
  61. tslib_1.__decorate([
  62. (0, asn1_schema_1.AsnProp)({
  63. type: OtherName, context: 0, implicit: true,
  64. })
  65. ], GeneralName.prototype, "otherName", void 0);
  66. tslib_1.__decorate([
  67. (0, asn1_schema_1.AsnProp)({
  68. type: asn1_schema_1.AsnPropTypes.IA5String, context: 1, implicit: true,
  69. })
  70. ], GeneralName.prototype, "rfc822Name", void 0);
  71. tslib_1.__decorate([
  72. (0, asn1_schema_1.AsnProp)({
  73. type: asn1_schema_1.AsnPropTypes.IA5String, context: 2, implicit: true,
  74. })
  75. ], GeneralName.prototype, "dNSName", void 0);
  76. tslib_1.__decorate([
  77. (0, asn1_schema_1.AsnProp)({
  78. type: asn1_schema_1.AsnPropTypes.Any, context: 3, implicit: true,
  79. })
  80. ], GeneralName.prototype, "x400Address", void 0);
  81. tslib_1.__decorate([
  82. (0, asn1_schema_1.AsnProp)({
  83. type: name_1.Name, context: 4, implicit: false,
  84. })
  85. ], GeneralName.prototype, "directoryName", void 0);
  86. tslib_1.__decorate([
  87. (0, asn1_schema_1.AsnProp)({
  88. type: EDIPartyName, context: 5,
  89. })
  90. ], GeneralName.prototype, "ediPartyName", void 0);
  91. tslib_1.__decorate([
  92. (0, asn1_schema_1.AsnProp)({
  93. type: asn1_schema_1.AsnPropTypes.IA5String, context: 6, implicit: true,
  94. })
  95. ], GeneralName.prototype, "uniformResourceIdentifier", void 0);
  96. tslib_1.__decorate([
  97. (0, asn1_schema_1.AsnProp)({
  98. type: asn1_schema_1.AsnPropTypes.OctetString,
  99. context: 7,
  100. implicit: true,
  101. converter: exports.AsnIpConverter,
  102. })
  103. ], GeneralName.prototype, "iPAddress", void 0);
  104. tslib_1.__decorate([
  105. (0, asn1_schema_1.AsnProp)({
  106. type: asn1_schema_1.AsnPropTypes.ObjectIdentifier, context: 8, implicit: true,
  107. })
  108. ], GeneralName.prototype, "registeredID", void 0);
  109. exports.GeneralName = GeneralName = tslib_1.__decorate([
  110. (0, asn1_schema_1.AsnType)({ type: asn1_schema_1.AsnTypeTypes.Choice })
  111. ], GeneralName);