rsassa_pss.js 1.4 KB

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