2016-08-17 26 views

回答

3

订阅由app模块发出的certificate-error事件,并确认在事件处理程序的自签名的证书。

6

你需要把下面的代码放到你的“壳”(核心电子INIT)文件:

// SSL/TSL: this is the self signed certificate support 
    app.on('certificate-error', (event, webContents, url, error, certificate, callback) => { 
     // On certificate error we disable default behaviour (stop loading the page) 
     // and we then say "it is all fine - true" to the callback 
     event.preventDefault(); 
     callback(true); 
    }); 

但是,这允许你喜欢自我不安全(无效)证书签名的一个。

请注意,这不是连接到服务器的安全方式。

欲了解更多,你可以检查文件:https://electron.atom.io/docs/api/app/#event-certificate-error

相关问题