rsassa_pss.js 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. exports.RSASSA_PSS = exports.RsaSaPssParams = void 0;
  4. const tslib_1 = require("tslib");
  5. const asn1_schema_1 = require("@peculiar/asn1-schema");
  6. const asn1_x509_1 = require("@peculiar/asn1-x509");
  7. const object_identifiers_1 = require("../object_identifiers");
  8. const algorithms_1 = require("../algorithms");
  9. class RsaSaPssParams {
  10. hashAlgorithm = new asn1_x509_1.AlgorithmIdentifier(algorithms_1.sha1);
  11. maskGenAlgorithm = new asn1_x509_1.AlgorithmIdentifier({
  12. algorithm: object_identifiers_1.id_mgf1,
  13. parameters: asn1_schema_1.AsnConvert.serialize(algorithms_1.sha1),
  14. });
  15. saltLength = 20;
  16. trailerField = 1;
  17. constructor(params = {}) {
  18. Object.assign(this, params);
  19. }
  20. }
  21. exports.RsaSaPssParams = RsaSaPssParams;
  22. tslib_1.__decorate([
  23. (0, asn1_schema_1.AsnProp)({
  24. type: asn1_x509_1.AlgorithmIdentifier,
  25. context: 0,
  26. defaultValue: algorithms_1.sha1,
  27. })
  28. ], RsaSaPssParams.prototype, "hashAlgorithm", void 0);
  29. tslib_1.__decorate([
  30. (0, asn1_schema_1.AsnProp)({
  31. type: asn1_x509_1.AlgorithmIdentifier,
  32. context: 1,
  33. defaultValue: algorithms_1.mgf1SHA1,
  34. })
  35. ], RsaSaPssParams.prototype, "maskGenAlgorithm", void 0);
  36. tslib_1.__decorate([
  37. (0, asn1_schema_1.AsnProp)({
  38. type: asn1_schema_1.AsnPropTypes.Integer,
  39. context: 2,
  40. defaultValue: 20,
  41. })
  42. ], RsaSaPssParams.prototype, "saltLength", void 0);
  43. tslib_1.__decorate([
  44. (0, asn1_schema_1.AsnProp)({
  45. type: asn1_schema_1.AsnPropTypes.Integer,
  46. context: 3,
  47. defaultValue: 1,
  48. })
  49. ], RsaSaPssParams.prototype, "trailerField", void 0);
  50. exports.RSASSA_PSS = new asn1_x509_1.AlgorithmIdentifier({
  51. algorithm: object_identifiers_1.id_RSASSA_PSS,
  52. parameters: asn1_schema_1.AsnConvert.serialize(new RsaSaPssParams()),
  53. });