Hello there.
I don't know if this is a really issue, but I'm a little confuse about generating and using RSA and public/private keys.
I've tried some examples but didn't get any success.
Is there any tutorial or example about changing the use of jwt.sign and jwt.verify methods to adopt RSA and public/private keys?
I was able to develop an example of generating public and private keys for RSA in Node.js
I'll share the implementation to help others with the same question :)
var fs = require('fs');
var keypair = require('keypair');
var pair = keypair({
bits: 2048, // size for the private key in bits. Default: 2048
e: 65537 // public exponent to use. Default: 65537
});
fs.writeFile(__dirname + '/keys/private.key', pair.private, function(err) {
if (err) {
return console.error(err);
}
console.log('RSA private key file generated');
});
fs.writeFile(__dirname + '/keys/public.pem', pair.public, function(err) {
if (err) {
return console.error(err);
}
console.log('RSA public key file generated');
});
Most helpful comment
I was able to develop an example of generating public and private keys for RSA in Node.js
I'll share the implementation to help others with the same question :)