rzcoder/node-rsa

Encrypted Private Key?

ddzobov opened this issue · 1 comments

Can this library generate and work with encrypted private keys?

-----BEGIN ENCRYPTED PRIVATE KEY-----

No, apparently not. Check this other issue .
You're probably better off using standard crypto anyway.

const crypto = require('crypto');
const MyEncryptedPrivKey = require('fs').readFileSync('./keys/enc_private.pem').toString();
const EncryptedData = [...];

let DecryptedData = crypto.privateDecrypt({
    key: MyEncryptedPrivKey,
    passphrase: "MY_PRIVATE_KEY_AWESOME_PASSWORD",
}, EncryptedData);