[英]How to fix missing an Intermediate/chain certificate in nodejs with certificate of type .pfx
我有一个 in.pfx 格式的证书,当我使用以下代码并使用 ssl 检查 ssl 时,我得到中间证书丢失错误。
if(process.env.NODE_ENV === "production") {
var credentials = {
pfx: fs.readFileSync('C:/self/certificate/testname.com.pfx'),
passphrase: "ffffff!"
};
this.app.server = https.createServer(credentials, this.app);
this.app.server.timeout = 600000;
this.init();
const httpServer = http.createServer((req, res) => {
res.writeHead(301, {Location: `https://${req.headers.host}${req.url}`});
res.end();
});
httpServer.listen(80);
} else {
this.app.server = http.createServer(this.app);
this.init();
}
请让我知道如何使用它。 我已经看过一些帖子,例如示例
但是找不到可以帮助您安装 type.pfx 证书的东西。 帮助赞赏。 -AJ
经过所有研究和示例发布Sample ,
我使用 openSSL 从 pfx 文件生成了 .crt、.ca-bundle 和 .pem 文件,然后将所有行从 .ca-bundle 附加到 .crt 文件,然后在下面的代码中使用。
var credentials = {
key: fs.readFileSync('C:/testApp/certificate/private-key.pem'),
cert: fs.readFileSync('C:/testApp/certificate/certificate.crt'),
};
this.app.server = https.createServer(credentials, this.app);
并重新运行服务器。 一切都很好,我能够成功地看到中间证书链。 谢谢-AJ
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.