rsaes_oaep.js 1.2 KB

1234567891011121314151617181920212223242526272829
  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";
  5. import { sha1, mgf1SHA1, pSpecifiedEmpty } from "../algorithms";
  6. export class RsaEsOaepParams {
  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.pSourceAlgorithm = new AlgorithmIdentifier(pSpecifiedEmpty);
  14. Object.assign(this, params);
  15. }
  16. }
  17. __decorate([
  18. AsnProp({ type: AlgorithmIdentifier, context: 0, defaultValue: sha1 })
  19. ], RsaEsOaepParams.prototype, "hashAlgorithm", void 0);
  20. __decorate([
  21. AsnProp({ type: AlgorithmIdentifier, context: 1, defaultValue: mgf1SHA1 })
  22. ], RsaEsOaepParams.prototype, "maskGenAlgorithm", void 0);
  23. __decorate([
  24. AsnProp({ type: AlgorithmIdentifier, context: 2, defaultValue: pSpecifiedEmpty })
  25. ], RsaEsOaepParams.prototype, "pSourceAlgorithm", void 0);
  26. export const RSAES_OAEP = new AlgorithmIdentifier({
  27. algorithm: id_RSAES_OAEP,
  28. parameters: AsnConvert.serialize(new RsaEsOaepParams()),
  29. });