我正在开发一个Node.js应用程序,我们称之为"服务器A",用户必须提供客户端证书才能访问服务.
简化示例:
/** server setup **/
var serverOptions = {
key: fs.readFileSync('certs/server.key'),
cert: fs.readFileSync('certs/server.crt'),
ca: [fs.readFileSync('certs/ca.crt'), fs.readFileSync('certs/bar.cer'), fs.readFileSync('certs/foo.cer')],
requestCert: true
};
https.createServer(serverOptions, app).listen(SERVER_PORT, '', null, function () {
var host = this.address().address;
var port = this.address().port;
console.log('listening at http://%s:%s', host, port);
});
Run Code Online (Sandbox Code Playgroud)
一切都按预期工作,以下代码打印客户端证书的详细信息.
app.get('/', function (req, res) {
/*** Dump ***/
res.contentType('application/json');
res.send(util.inspect(req.socket.getPeerCertificate(true), {colors: true}));
});
Run Code Online (Sandbox Code Playgroud)
但是,我希望能够使用在serverA中获得的此客户端证书,向另一个名为"server B"的服务器发出请求.
options = {
hostname: 'localhost',
port: '3010',
path: '/',
method: 'POST',
headers: {
'Content-Type': 'text/xml;charset=UTF-8',
'Content-Length': serverResponse.length,
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8',
},
cert: clientCertificate …Run Code Online (Sandbox Code Playgroud) 我一直在使用一种简单的机制在 Windows 10 上注册自定义 URL 协议,允许我们的 Web 应用程序中的链接启动客户端计算机上的本地程序。例如 :
<a href="mycustomprotocol://scan/0&1608962&1&248">启动程序</a>
在 regedit 中,协议在此处注册:
Ordinateur\HKEY_CLASSES_ROOT\mycustomprotocol\shell\open\command
其值为:
C:\Program Files (x86)\MyProgram\MyExecutable.exe“%1”
它已停止在 Chrome 63 上运行。开发控制台和网络选项卡中都没有显示任何内容,但它在 Firefox 或 Microsoft Edge 等上仍然运行良好。
如果我删除 C:\Users\johndoe\AppData\Local\Google\Chrome\User Data 中的用户个人资料,然后再次单击我的自定义链接,Chrome 会询问我是否要启动本地程序,但当我单击“打开”按钮。
有什么办法吗?这个功能现在被 Chrome 屏蔽了吗?这个能解封吗?感谢您的帮助。