rsaes_oaep.js 1.3 KB

1234567891011121314151617181920212223242526272829303132333435
  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, context: 0, defaultValue: sha1,
  20. })
  21. ], RsaEsOaepParams.prototype, "hashAlgorithm", void 0);
  22. __decorate([
  23. AsnProp({
  24. type: AlgorithmIdentifier, context: 1, defaultValue: mgf1SHA1,
  25. })
  26. ], RsaEsOaepParams.prototype, "maskGenAlgorithm", void 0);
  27. __decorate([
  28. AsnProp({
  29. type: AlgorithmIdentifier, context: 2, defaultValue: pSpecifiedEmpty,
  30. })
  31. ], RsaEsOaepParams.prototype, "pSourceAlgorithm", void 0);
  32. export const RSAES_OAEP = new AlgorithmIdentifier({
  33. algorithm: id_RSAES_OAEP,
  34. parameters: AsnConvert.serialize(new RsaEsOaepParams()),
  35. });