How to setup an EV Certificate a node.js server

后端 未结 1 885
借酒劲吻你
借酒劲吻你 2021-01-27 05:19

I\'ve received four files from Comodo:

AddTrustExternalCARoot.crt
COMODORSAAddTrustCA.crt
COMODORSAExtendedValidationSecureServerCA.crt
mydomain.crt
1条回答
  •  北海茫月
    2021-01-27 06:14

    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);
    

    Or you can use just pfx if you have your key, cert, and ca files all bundled into a single PFX/PKCS12-formatted file.

    0 讨论(0)
提交回复
热议问题