private_key_info.js 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. "use strict";
  2. var Attributes_1;
  3. Object.defineProperty(exports, "__esModule", { value: true });
  4. exports.PrivateKeyInfo = exports.Attributes = exports.PrivateKey = exports.Version = void 0;
  5. const tslib_1 = require("tslib");
  6. const asn1_schema_1 = require("@peculiar/asn1-schema");
  7. const asn1_x509_1 = require("@peculiar/asn1-x509");
  8. var Version;
  9. (function (Version) {
  10. Version[Version["v1"] = 0] = "v1";
  11. })(Version || (exports.Version = Version = {}));
  12. class PrivateKey extends asn1_schema_1.OctetString {
  13. }
  14. exports.PrivateKey = PrivateKey;
  15. let Attributes = Attributes_1 = class Attributes extends asn1_schema_1.AsnArray {
  16. constructor(items) {
  17. super(items);
  18. Object.setPrototypeOf(this, Attributes_1.prototype);
  19. }
  20. };
  21. exports.Attributes = Attributes;
  22. exports.Attributes = Attributes = Attributes_1 = tslib_1.__decorate([
  23. (0, asn1_schema_1.AsnType)({
  24. type: asn1_schema_1.AsnTypeTypes.Sequence,
  25. itemType: asn1_x509_1.Attribute,
  26. })
  27. ], Attributes);
  28. class PrivateKeyInfo {
  29. version = Version.v1;
  30. privateKeyAlgorithm = new asn1_x509_1.AlgorithmIdentifier();
  31. privateKey = new PrivateKey();
  32. attributes;
  33. constructor(params = {}) {
  34. Object.assign(this, params);
  35. }
  36. }
  37. exports.PrivateKeyInfo = PrivateKeyInfo;
  38. tslib_1.__decorate([
  39. (0, asn1_schema_1.AsnProp)({ type: asn1_schema_1.AsnPropTypes.Integer })
  40. ], PrivateKeyInfo.prototype, "version", void 0);
  41. tslib_1.__decorate([
  42. (0, asn1_schema_1.AsnProp)({ type: asn1_x509_1.AlgorithmIdentifier })
  43. ], PrivateKeyInfo.prototype, "privateKeyAlgorithm", void 0);
  44. tslib_1.__decorate([
  45. (0, asn1_schema_1.AsnProp)({ type: PrivateKey })
  46. ], PrivateKeyInfo.prototype, "privateKey", void 0);
  47. tslib_1.__decorate([
  48. (0, asn1_schema_1.AsnProp)({
  49. type: Attributes,
  50. implicit: true,
  51. context: 0,
  52. optional: true,
  53. })
  54. ], PrivateKeyInfo.prototype, "attributes", void 0);