rsassa_pss.js 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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, context: 0, defaultValue: algorithms_1.sha1,
  25. })
  26. ], RsaSaPssParams.prototype, "hashAlgorithm", void 0);
  27. tslib_1.__decorate([
  28. (0, asn1_schema_1.AsnProp)({
  29. type: asn1_x509_1.AlgorithmIdentifier, context: 1, defaultValue: algorithms_1.mgf1SHA1,
  30. })
  31. ], RsaSaPssParams.prototype, "maskGenAlgorithm", void 0);
  32. tslib_1.__decorate([
  33. (0, asn1_schema_1.AsnProp)({
  34. type: asn1_schema_1.AsnPropTypes.Integer, context: 2, defaultValue: 20,
  35. })
  36. ], RsaSaPssParams.prototype, "saltLength", void 0);
  37. tslib_1.__decorate([
  38. (0, asn1_schema_1.AsnProp)({
  39. type: asn1_schema_1.AsnPropTypes.Integer, context: 3, defaultValue: 1,
  40. })
  41. ], RsaSaPssParams.prototype, "trailerField", void 0);
  42. exports.RSASSA_PSS = new asn1_x509_1.AlgorithmIdentifier({
  43. algorithm: object_identifiers_1.id_RSASSA_PSS,
  44. parameters: asn1_schema_1.AsnConvert.serialize(new RsaSaPssParams()),
  45. });