【发布时间】:2016-04-22 12:14:49
【问题描述】:
我使用这些链接中的简单示例:
a link[a 如何在 Node.js 中创建 HTTPS 服务器?]
a link[a 如何创建https服务器? docs.nodejitsu.com]
但我得到类似的错误
curl: (35) 连接到 localhost:-9838 时出现未知 SSL 协议错误
为什么?
【问题讨论】:
我使用这些链接中的简单示例:
a link[a 如何在 Node.js 中创建 HTTPS 服务器?]
a link[a 如何创建https服务器? docs.nodejitsu.com]
但我得到类似的错误
curl: (35) 连接到 localhost:-9838 时出现未知 SSL 协议错误
为什么?
【问题讨论】:
我使用错误的方式创建证书。
这个错了:
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
这是创建可以使用的证书的方法:
openssl genrsa -out client-key.pem 2048
openssl req -new -key client-key.pem -out client.csr
openssl x509 -req -in client.csr -signkey client-key.pem -out client-cert.pem
【讨论】:
genrsa 命令上的 2048 - 没有它,默认密钥是一个弱的 512 位。我能找到的该错误代码的唯一参考是Apple source code,它是errSSLPeerInternalError(但距离errSSLPeerInsufficientSecurity只有一个距离)。
-days 9999 参数也适用于第二种方法