rsassa_pss.js 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  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, context: 0, defaultValue: sha1,
  21. })
  22. ], RsaSaPssParams.prototype, "hashAlgorithm", void 0);
  23. __decorate([
  24. AsnProp({
  25. type: AlgorithmIdentifier, context: 1, defaultValue: mgf1SHA1,
  26. })
  27. ], RsaSaPssParams.prototype, "maskGenAlgorithm", void 0);
  28. __decorate([
  29. AsnProp({
  30. type: AsnPropTypes.Integer, context: 2, defaultValue: 20,
  31. })
  32. ], RsaSaPssParams.prototype, "saltLength", void 0);
  33. __decorate([
  34. AsnProp({
  35. type: AsnPropTypes.Integer, context: 3, defaultValue: 1,
  36. })
  37. ], RsaSaPssParams.prototype, "trailerField", void 0);
  38. export const RSASSA_PSS = new AlgorithmIdentifier({
  39. algorithm: id_RSASSA_PSS,
  40. parameters: AsnConvert.serialize(new RsaSaPssParams()),
  41. });