I found some libraries that create private-public key pairs. I can't decide which one to use in my nodejs project because they all look abandoned to me. I feel like the crypto
module is the only one that should be trusted at the moment. What I don't know is that if the generated key will be a valid rsa key just as I would create it using the openssl rsa
command.
Currently I use opendkim-genkey
command which creates a private key file and a file with DNS record example containing the public key. The script uses opnessl rsa
command. I would like to achieve the same using nodejs. Using shell commands is slow and you usually write into a temp file (I would like to do this in memory).
So the question is how can I create a valid rsa private-public key pair with nodejs (probably crypto
module)? Examples welcome, thx.
UPDATE:
Basically I have to translate openssl genrsa -out xxx.private 1024
and openssl rsa -in xxx.private -pubout -out xxx.public -outform PEM
commands to a valid crypto
syntax (I guess).