rsaes_oaep.js 1.7 KB

123456789101112131415161718192021222324252627282930313233
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. exports.RSAES_OAEP = exports.RsaEsOaepParams = void 0;
  4. const tslib_1 = require("tslib");
  5. const asn1_schema_1 = require("@peculiar/asn1-schema");
  6. const asn1_x509_1 = require("@peculiar/asn1-x509");
  7. const object_identifiers_1 = require("../object_identifiers");
  8. const algorithms_1 = require("../algorithms");
  9. class RsaEsOaepParams {
  10. constructor(params = {}) {
  11. this.hashAlgorithm = new asn1_x509_1.AlgorithmIdentifier(algorithms_1.sha1);
  12. this.maskGenAlgorithm = new asn1_x509_1.AlgorithmIdentifier({
  13. algorithm: object_identifiers_1.id_mgf1,
  14. parameters: asn1_schema_1.AsnConvert.serialize(algorithms_1.sha1),
  15. });
  16. this.pSourceAlgorithm = new asn1_x509_1.AlgorithmIdentifier(algorithms_1.pSpecifiedEmpty);
  17. Object.assign(this, params);
  18. }
  19. }
  20. exports.RsaEsOaepParams = RsaEsOaepParams;
  21. tslib_1.__decorate([
  22. (0, asn1_schema_1.AsnProp)({ type: asn1_x509_1.AlgorithmIdentifier, context: 0, defaultValue: algorithms_1.sha1 })
  23. ], RsaEsOaepParams.prototype, "hashAlgorithm", void 0);
  24. tslib_1.__decorate([
  25. (0, asn1_schema_1.AsnProp)({ type: asn1_x509_1.AlgorithmIdentifier, context: 1, defaultValue: algorithms_1.mgf1SHA1 })
  26. ], RsaEsOaepParams.prototype, "maskGenAlgorithm", void 0);
  27. tslib_1.__decorate([
  28. (0, asn1_schema_1.AsnProp)({ type: asn1_x509_1.AlgorithmIdentifier, context: 2, defaultValue: algorithms_1.pSpecifiedEmpty })
  29. ], RsaEsOaepParams.prototype, "pSourceAlgorithm", void 0);
  30. exports.RSAES_OAEP = new asn1_x509_1.AlgorithmIdentifier({
  31. algorithm: object_identifiers_1.id_RSAES_OAEP,
  32. parameters: asn1_schema_1.AsnConvert.serialize(new RsaEsOaepParams()),
  33. });