general_name.js 3.9 KB

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