Skip to content

RSA_PKCS1_PADDING is no longer supported for private decryption #6630

Discussion options

You must be logged in to vote

Sorry, forgot to post this update, but found a workaround by using NodeRSA and setting the environment to browser (It will use the node crypto library with the CVE by default)

import NodeRSA from "node-rsa";

const privateKeyString = Buffer.from(
  process.env.PRIVATE_KEY ?? "",
  "base64",
).toString("utf8");

const privateKey = new NodeRSA(privateKeyString);
privateKey.setOptions({ encryptionScheme: "pkcs1", environment: "browser" });

const decryptedRequestData = privateKey
  .decrypt(encryptedBody)
  .toString("utf8");

console.log("decryptedRequestData", decryptedRequestData);

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@MrRahulRamkumar
Comment options

Answer selected by MrRahulRamkumar
@Mentiroot
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
2 participants