title: curl: (35) schannel: SNI or certificate check failed: SEC_E_WRONG_PRINCIPAL (0x80090322) - The target principal name is incorrect
body: <p>I am trying to setup a https server for local development.I am using a Windows 10 machine . I have generated a self signed Certificate using openssl. I used the following commands.</p>
  
  <pre><code>openssl genrsa -out key.pem
  openssl req -new -key key.pem -out csr.pem
  openssl x509 -req -days 9999 -in csr.pem -signkey key.pem -out cert.pem
  rm csr.pem
  </code></pre>
  
  <p>This is demo Server code (NodeJS) which outputs "hello world".</p>
  
  <pre><code>const https = require('https');
  const fs = require('fs');
  
  const options = {
    key: fs.readFileSync('key.pem'),
    cert: fs.readFileSync('cert.pem')
  };
  
  
  https.createServer(options, function (req, res) {
    res.writeHead(200);
    res.end("hello world\n");
  }).listen(8000);
  </code></pre>
  
  <p>I have accessed the URL from command prompt using curl command</p>
  
  <pre><code>curl https://localhost:8000
  </code></pre>
  
  <p>I am getting the error as </p>
  
  <pre><code>curl: (35) schannel: SNI or certificate check failed: SEC_E_WRONG_PRINCIPAL (0x80090322) - The target principal name is incorrect.
  </code></pre>
  
  <p>I have added the self signed certificated in the "Trusted root certificate authority" store using the "Microsoft management Console (mmc)". This is my
  <a href="https://i.stack.imgur.com/kVokq.png" rel="nofollow noreferrer">Certificate image</a>.</p>
  
  <p>I don't understand where i am going wrong. Please help me solve this issue.</p>