title: Failed to load resource: net::ERR_CERT_AUTHORITY_INVALID
body: <p>I am implementing node js script over https.</p>
  
  <p>Node js</p>
  
  <pre><code>const options = {
    key: fs.readFileSync('private.key'),
    cert: fs.readFileSync('cert.crt'),    
    // This is necessary only if using the client certificate authentication.
    requestCert: true,
    rejectUnauthorized: true,
  
    // This is necessary only if the client uses the self-signed certificate.
    ca: [fs.readFileSync('client-cert.pem')]
  };
  </code></pre>
  
  <p>On each request this is giving error:- ERR_CERT_AUTHORITY_INVALID</p>
  
  <p>I have searched a lot but nothing found.</p>
  
  <p>I use below command for generating client key:-</p>
  
  <blockquote>
    <p>openssl req -x509 -newkey rsa:2048 -keyout client-key.pem -out
    client-cert.pem -days 365</p>
  </blockquote>
  
  <p>I create .crt and private keys on server and using them.</p>
  
  <p>What I am doing wrong here?</p>