[英]How to setup an EV Certificate a node.js server
I've received four files from Comodo: 我已经从Comodo收到了四个文件:
AddTrustExternalCARoot.crt
COMODORSAAddTrustCA.crt
COMODORSAExtendedValidationSecureServerCA.crt
mydomain.crt
This is my first time setting up a https server. 这是我第一次设置https服务器。
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. 我知道我必须放入传递给
https.createServer
参数,但是我的问题是我不知道哪个参数是正确的属性。
The server certificate is set as cert
, whereas your CA certificates are set under ca
: 服务器证书设置为
cert
,而您的CA证书设置为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);
Or you can use just pfx
if you have your key
, cert
, and ca
files all bundled into a single PFX/PKCS12-formatted file. 或者,如果将
key
, cert
和ca
文件全部捆绑到一个PFX / PKCS12格式的文件中,则可以仅使用pfx
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.