0
votes

I have a .key file with password and I need to get the .pem file with RSA PKCS8 method with NodeJS function.

The command I use to do it with OpenSSL is the following

How can I do this in NodeJS???

openssl pkcs8 -inform DER -in file.key -out file.pem -passin pass:passwordkey

1
do you resolve this? - J261

1 Answers

0
votes

Let's say for example you have a key.pem file in a https folder and you want it as a parameter for your server options. You can get it via fs.readFileSync. Hope this helps.

const path = require("path");

server.httpsServerOptions = {
    key: fs.readFileSync(path.join(_dirName, "./../https/key.pem"))
};