private_key_info.js 1.8 KB

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