如何将EV证书设置为node.js服务器

编程入门 行业动态 更新时间:2024-10-08 13:31:16
本文介绍了如何将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服务器

本文发布于:2023-11-28 11:46:06,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1642272.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:设置为   如何将   证书   服务器   node

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!