general_name.js 2.7 KB

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