rsassa_pss.js 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637
  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. constructor(params = {}) {
  11. this.hashAlgorithm = new asn1_x509_1.AlgorithmIdentifier(algorithms_1.sha1);
  12. this.maskGenAlgorithm = new asn1_x509_1.AlgorithmIdentifier({
  13. algorithm: object_identifiers_1.id_mgf1,
  14. parameters: asn1_schema_1.AsnConvert.serialize(algorithms_1.sha1),
  15. });
  16. this.saltLength = 20;
  17. this.trailerField = 1;
  18. Object.assign(this, params);
  19. }
  20. }
  21. exports.RsaSaPssParams = RsaSaPssParams;
  22. tslib_1.__decorate([
  23. (0, asn1_schema_1.AsnProp)({ type: asn1_x509_1.AlgorithmIdentifier, context: 0, defaultValue: algorithms_1.sha1 })
  24. ], RsaSaPssParams.prototype, "hashAlgorithm", void 0);
  25. tslib_1.__decorate([
  26. (0, asn1_schema_1.AsnProp)({ type: asn1_x509_1.AlgorithmIdentifier, context: 1, defaultValue: algorithms_1.mgf1SHA1 })
  27. ], RsaSaPssParams.prototype, "maskGenAlgorithm", void 0);
  28. tslib_1.__decorate([
  29. (0, asn1_schema_1.AsnProp)({ type: asn1_schema_1.AsnPropTypes.Integer, context: 2, defaultValue: 20 })
  30. ], RsaSaPssParams.prototype, "saltLength", void 0);
  31. tslib_1.__decorate([
  32. (0, asn1_schema_1.AsnProp)({ type: asn1_schema_1.AsnPropTypes.Integer, context: 3, defaultValue: 1 })
  33. ], RsaSaPssParams.prototype, "trailerField", void 0);
  34. exports.RSASSA_PSS = new asn1_x509_1.AlgorithmIdentifier({
  35. algorithm: object_identifiers_1.id_RSASSA_PSS,
  36. parameters: asn1_schema_1.AsnConvert.serialize(new RsaSaPssParams()),
  37. });