miladezzat/encrypt-rsa

Error: error:04099079:rsa routines:RSA_padding_check_PKCS1_OAEP_mgf1:oaep decoding error

Closed this issue · 1 comments

I'm receiving an error while trying to execute an automation run, the error is the following:
Error: error:04099079:rsa routines:RSA_padding_check_PKCS1_OAEP_mgf1:oaep decoding error at NodeRSA.decryptStringWithRsaPrivateKey

The script:

`import EncryptRsa from 'encrypt-rsa';
const encryptRsa = new EncryptRsa();
const { privateKey, publicKey } = encryptRsa.createPrivateAndPublicKeys();

function encrypt(text: string) {
return encryptRsa.encryptStringWithRsaPublicKey({
text,
publicKey,
});
}

function decrypt(encryptedText: string) {
return encryptRsa.decryptStringWithRsaPrivateKey({
text: encryptedText,
privateKey,
});`

In other possible solutions I read that we need to add a padding to solve this issue:
https://www.anycodings.com/1questions/3120595/error-error04099079rsa-routinesrsapaddingcheckpkcs1oaepmgf1oaep-decoding-error

fixed