title: How to create a Certificate Authority 'CA' using pem lib NodeJs?
body: <p>Creating a CA using node</p>
  <p>This is how to create a certificate using OpenSSL
  <a href="https://jamielinux.com/docs/openssl-certificate-authority/introduction.html" rel="nofollow noreferrer">OpenSSL Certificate Authority</a></p>
  <p>I tried with <a href="https://github.com/Dexus/pem" rel="nofollow noreferrer">pem</a></p>
  <blockquote>
  <p>This is my closed Issue <a href="https://github.com/Dexus/pem/issues/244" rel="nofollow noreferrer">can't create CSR from private key #244</a> <strong>GitHub</strong></p>
  </blockquote>
  <p>When I trying to generate a <strong>CSR</strong></p>
  <pre><code>var csrOptions = {
      clientKey: '/root/ca/intermediate/private/client.key.pem',
      clientKeyPassword: '123456',
      hash: 'sha256',
      country: 'US',
      state: 'California',
      locality: 'Mountain View',
      organization: 'Alice Ltd',
      organizationUnit: 'Alice Ltd Web Services',
      commonName: 'pass:client',
  }
  
  pem.createCSR( csrOptions , function(err, csr) {
      if (err) {
          throw err
      } else {
          console.log(csr.clientKey)
          console.log(csr.csr)
      }
  
  });
  </code></pre>
  <p>I get this error</p>
  <blockquote>
  <p>/root/sslnode/index2.js:37</p>
  </blockquote>
  <blockquote>
  <p>throw err
  ^</p>
  </blockquote>
  <blockquote>
  <p>% openssl req -new -sha256 -config /root/ca/intermediate/openssl.cnf -key /tmp/54f976cb9cbd0e2dd53b755badb6e6e3fe2256ad -passin file:/tmp/3f4640f1d95ca955f1c44c7f2c4b729347813a5f</p>
  </blockquote>
  <blockquote>
  <p>unable to load Private Key
  140563986715072:error:0906D06C:PEM routines:PEM_read_bio:no start &gt;line:../crypto/pem/pem_lib.c:691:Expecting: ANY PRIVATE KEY</p>
  </blockquote>