rsassa_pss.js 1.3 KB

123456789101112131415161718192021222324252627282930313233
  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";
  5. import { sha1, mgf1SHA1 } from "../algorithms";
  6. export class RsaSaPssParams {
  7. constructor(params = {}) {
  8. this.hashAlgorithm = new AlgorithmIdentifier(sha1);
  9. this.maskGenAlgorithm = new AlgorithmIdentifier({
  10. algorithm: id_mgf1,
  11. parameters: AsnConvert.serialize(sha1),
  12. });
  13. this.saltLength = 20;
  14. this.trailerField = 1;
  15. Object.assign(this, params);
  16. }
  17. }
  18. __decorate([
  19. AsnProp({ type: AlgorithmIdentifier, context: 0, defaultValue: sha1 })
  20. ], RsaSaPssParams.prototype, "hashAlgorithm", void 0);
  21. __decorate([
  22. AsnProp({ type: AlgorithmIdentifier, context: 1, defaultValue: mgf1SHA1 })
  23. ], RsaSaPssParams.prototype, "maskGenAlgorithm", void 0);
  24. __decorate([
  25. AsnProp({ type: AsnPropTypes.Integer, context: 2, defaultValue: 20 })
  26. ], RsaSaPssParams.prototype, "saltLength", void 0);
  27. __decorate([
  28. AsnProp({ type: AsnPropTypes.Integer, context: 3, defaultValue: 1 })
  29. ], RsaSaPssParams.prototype, "trailerField", void 0);
  30. export const RSASSA_PSS = new AlgorithmIdentifier({
  31. algorithm: id_RSASSA_PSS,
  32. parameters: AsnConvert.serialize(new RsaSaPssParams()),
  33. });