axl*_*lpl 5 ssl https node.js express p7b
我很抱歉我的语言,但我不会说英语.
我正在尝试在我的应用程序SSL中实现,但我只有由csr文件创建的valud p7b.我在linux服务器上使用expressjs和node js.我知道如何实施PEM证书
var options = {
key: fs.readFileSync('./private.pem'),
cert: fs.readFileSync('./' + config.ssl[config.mode].cert)
};
server = https.createServer(options, app).listen(3000);
Run Code Online (Sandbox Code Playgroud)
但我不知道如何实施p7b证书,请帮助我
首先,您必须将 p7b 转换为 pem 格式:
openssl pkcs7 -in public.p7b -inform DER -out public.pem -print_certs
Run Code Online (Sandbox Code Playgroud)
创建包含您的私钥和公共证书的 pkcs12 文件:
openssl pkcs12 -export -inkey private.key -in public.pem -name my_name -out result.pfx
Run Code Online (Sandbox Code Playgroud)
要将 pfx 文件与 Node js 一起使用,请使用
const cert = fs.readFileSync("result.pfx");
const request = require('request').defaults({
agentOptions: {
pfx: cert,
passphrase: password
}
});
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
899 次 |
| 最近记录: |