Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

218
Views
I am using node to encrypt and decrypt a message but the encryption works fin when I try to decrypt it will show me error

I am using node to encrypt and decrypt a message but the encryption works fin when I try to decrypt it will show me error "Error during decryption (probably incorrect key). Original error: Error: error:0407008A:RSA routines:RSA_padding_check_PKCS1_type_1:invalid padding"


 const keyData = `-----BEGIN PUBLIC KEY-----\n${publicKey}\n-----END PUBLIC KEY-----`;
    const rsaKey = new NodeRSA(keyData, "public", { encryptionScheme: "pkcs1" });
     const encryptPublic = (rawData) => {
      const dataString = JSON.stringify(rawData);
      const data = Buffer.from(dataString);
      return rsaKey.encrypt(data, "base64", "utf8");
  };
  let encriptedData = encryptPublic(body);
    const decryptPublic = (dataToDecrypt) => {
      const decryptedData = rsaKey.decryptPublic(dataToDecrypt, "utf8");
      return decryptedData;
    };
    let decryptBody = decryptPublic(encriptedData);```
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!