rsaes_oaep.js 1.3 KB

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