private_key_info.js 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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, itemType: asn1_x509_1.Attribute,
  25. })
  26. ], Attributes);
  27. class PrivateKeyInfo {
  28. version = Version.v1;
  29. privateKeyAlgorithm = new asn1_x509_1.AlgorithmIdentifier();
  30. privateKey = new PrivateKey();
  31. attributes;
  32. constructor(params = {}) {
  33. Object.assign(this, params);
  34. }
  35. }
  36. exports.PrivateKeyInfo = PrivateKeyInfo;
  37. tslib_1.__decorate([
  38. (0, asn1_schema_1.AsnProp)({ type: asn1_schema_1.AsnPropTypes.Integer })
  39. ], PrivateKeyInfo.prototype, "version", void 0);
  40. tslib_1.__decorate([
  41. (0, asn1_schema_1.AsnProp)({ type: asn1_x509_1.AlgorithmIdentifier })
  42. ], PrivateKeyInfo.prototype, "privateKeyAlgorithm", void 0);
  43. tslib_1.__decorate([
  44. (0, asn1_schema_1.AsnProp)({ type: PrivateKey })
  45. ], PrivateKeyInfo.prototype, "privateKey", void 0);
  46. tslib_1.__decorate([
  47. (0, asn1_schema_1.AsnProp)({
  48. type: Attributes, implicit: true, context: 0, optional: true,
  49. })
  50. ], PrivateKeyInfo.prototype, "attributes", void 0);