本文介绍了如何将EV证书设置为node.js服务器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我收到了来自Comodo的四个文件:
I've received four files from Comodo:
AddTrustExternalCARoot.crt COMODORSAAddTrustCA.crt COMODORSAExtendedValidationSecureServerCA.crt mydomain.crt这是我第一次设置https服务器。
This is my first time setting up a https server.
我知道我必须把参数传递给 https.createServer 但我的问题是我不知道不知道哪一个是正确的属性。
I know that I have to put on parameters that is passed to https.createServer but my problem is I don't know which one is the correct property.
推荐答案服务器证书设置为 cert ,而您的CA证书设置在 ca 下:
The server certificate is set as cert, whereas your CA certificates are set under ca:
var fs = require('fs'), https = require('https'); var cfg = { key: fs.readFileSync('/path/to/privatekey.pem'), cert: fs.readFileSync('/path/to/mydomain.crt'), // PEM format ca: [ fs.readFileSync('/path/to/AddTrustExternalCARoot.crt'), // PEM format fs.readFileSync('/path/to/COMODORSAAddTrustCA.crt'), // PEM format fs.readFileSync('/path/to/COMODORSAExtendedValidationSecureServerCA.crt') // PEM format ] }; https.createServer(cfg, function(req, res) { // ... }).listen(443);或者如果你只使用 pfx 将键,证书和 ca 所有文件捆绑在一起到一个PFX / PKCS12格式的文件。
Or you can use just pfx if you have your key, cert, and ca files all bundled into a single PFX/PKCS12-formatted file.
更多推荐
如何将EV证书设置为node.js服务器
发布评论