NodeJS & SSL - “bad password read”

后端 未结 3 1823
执笔经年
执笔经年 2020-12-15 15:40

Node is failing to create a secure context for SSL communications.

Specifically, I\'m trying to get remote notifications to work on iOS. I use a module, called node-

3条回答
  •  攒了一身酷
    2020-12-15 15:48

    This is because you've specified a passphrase when generating the cert. This is a password that must be supplied by anyone wanting to use it.

    Adding a passphrase field to the credentials solves the problem.

    var credentials = {
        key: fs.readFileSync('XXX.key', 'utf8'),
        cert: fs.readFileSync('XXX.crt', 'utf8'),
        passphrase: 'XXXX'
    }
    
    var httpsServer = https.createServer(credentials, app);
    

提交回复
热议问题