title: How to load encrypted private key in Node.JS
body: <p>I would like to use the node <a href="https://nodejs.org/api/crypto.html#crypto_class_sign" rel="noreferrer">Crypto:Sign</a> module with an encrypted private key. Is there functionality within Crypto module that allows me to decrypt my private key? </p>
  
  <p>For example, in Python there is an <a href="http://www.pyopenssl.org/en/stable/api/crypto.html#OpenSSL.crypto.load_privatekey" rel="noreferrer">OpenSSL.crypto.load_privatekey</a> function that takes a passphrase to decrypt the private key. I am looking to achieve the same functionality but using Node.JS libraries. </p>
  
  <pre><code>const crypto = require('crypto');
  const sign = crypto.createSign('sha256');
  
  sign.update('some data to sign');
  
  let private_key = '-----BEGIN ENCRYPTED PRIVATE KEY-----\n' +
                      'ABCDEFGHIJKLMNOP\n' +  
                      '-----END ENCRYPTED PRIVATE KEY-----\n';
  
  // Somehow decrypt private_key using passphrase.    
  what_to_do(????);
  
  console.log(sign.sign(private_key).toString('hex'));
  </code></pre>