Encrypt the private key with a passphrase
masterProvide a passphrase in the options to encrypt the generated private key using AES-256-CBC. The resulting private key will be in encrypted PKCS#8 format (-----BEGIN ENCRYPTED PRIVATE KEY-----).
To use the encrypted key with Node.js https or crypto, you must provide the passphrase during decryption or server setup.
const https = require('https');
// Use directly with HTTPS server
https.createServer({
key: pems.private,
passphrase: 'my-secret-passphrase',
cert: pems.cert
}, app).listen(443);