-
-
Notifications
You must be signed in to change notification settings - Fork 33.8k
Closed
Labels
cryptoIssues and PRs related to the crypto subsystem.Issues and PRs related to the crypto subsystem.docIssues and PRs related to the documentations.Issues and PRs related to the documentations.
Description
- Version: v8.11.3
- Platform: Linux x86_64
- Subsystem:
I'm trying to encrypt/decrypt data using a rsa key but the process fails somehow with this message :
Error: error:04099079:rsa routines:RSA_padding_check_PKCS1_OAEP_mgf1:oaep decoding error
Code :
var childProcess = require('child_process');
var crypto = require('crypto');
var pk;
var mess_chiffre;
var sign = function () {
var buf = new Buffer("Coucou c'est relou!!!");
var sig = crypto.privateEncrypt(pk,buf);
mess_chiffre = sig.toString('hex');
console.log("Signed : ", mess_chiffre);
};
var decrypt = function () {
var buff = new Buffer(mess_chiffre,'hex')
console.log('Buffer : ',buff)
console.log('decrypting withh pk: ')
console.log(pk)
var mess = crypto.privateDecrypt(pk,buff)
console.log(mess)
};
childProcess.exec('openssl rsa -in private.key', {},
function (err, stdout, stderr) {
if (err) throw err;
pk = stdout; // Save in memory for later use
sign();
decrypt();
});Metadata
Metadata
Assignees
Labels
cryptoIssues and PRs related to the crypto subsystem.Issues and PRs related to the crypto subsystem.docIssues and PRs related to the documentations.Issues and PRs related to the documentations.