节点js 0.4中的https ssl密码

节点js 0.4中的https ssl密码,https,passwords,node.js,Https,Passwords,Node.js,节点0.2.6方式: var credentials = crypto.createCredentials({ "key": SSLKey, "cert": SSLCert, "ca": Ca, "password": SSLKeyPass }) var client = http.createClient(apiPort, host, true, credentials) node 0.4 way: var options = { host: apiHost

节点0.2.6方式:

var credentials = crypto.createCredentials({ "key": SSLKey, "cert": SSLCert, "ca": Ca, "password": SSLKeyPass })
var client = http.createClient(apiPort, host, true, credentials)


    node 0.4 way:
    var options = {
        host: apiHost,
        port: apiPort,
        method: 'GET',
        path: uri,
        headers: {host: host},
        key:SSLKey,
        cert:SSLCert,
        ca:Ca,
        password:SSLKeyPass
    }

    var request = https.request(options, function (response) {
正如您所看到的,需要一个密码,我不知道在节点0.4中密码应该放在哪里


SSLKeyPass在节点0.4上的位置是什么?

因此,即使在节点0.2.6源代码中,crypto.js模块也不会在传递给createCredentials的对象中查找密码属性。在版本0.4.8中,仍然没有在crypto.js模块中提到单词
password
。你的0.2.6代码真的有效吗

一般来说,使用openssl解密您的私钥,将其保存在磁盘上,并让您的节点代码读取该文件。这似乎是最常用的选择。其他选项是A)在启动节点服务器时必须手动键入密码短语以解密私钥(几乎没有人这样做)或B)将明文密码短语保留在磁盘上,这与将明文私钥保留在磁盘上没有任何区别,因此,对于私钥安全性问题,这也是一个非常罕见的解决方案

您可以使用openssl命令行解密私钥,如下所示:

openssl rsa -in your_encrypted_private.ekey -out your_private.key

openssl将以交互方式提示您输入密码短语。

对于记录,您可以在Node.js中创建凭据对象时提供密码短语。这表明可以为私钥或
PFX
文件提供
passphrase
选项。您不必将私钥以明文形式保存在节点的某个磁盘上