小编Muk*_*mar的帖子

curl: (35) schannel: SNI 或证书检查失败: SEC_E_WRONG_PRINCIPAL (0x80090322) - 目标主体名称不正确

我正在尝试为本地开发设置 https 服务器。我使用的是 Windows 10 计算机。我已经使用 openssl 生成了一个自签名证书。我使用了以下命令。

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
Run Code Online (Sandbox Code Playgroud)

这是输出“hello world”的演示服务器代码 (NodeJS)。

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);
Run Code Online (Sandbox Code Playgroud)

我已使用curl 命令从命令提示符访问了URL

curl https://localhost:8000
Run Code Online (Sandbox Code Playgroud)

我收到的错误是

curl: (35) schannel: SNI or certificate check failed: SEC_E_WRONG_PRINCIPAL (0x80090322) - The target principal …
Run Code Online (Sandbox Code Playgroud)

openssl mmc ssl-certificate x509

3
推荐指数
1
解决办法
2万
查看次数

标签 统计

mmc ×1

openssl ×1

ssl-certificate ×1

x509 ×1