node.js https pfx证书错误

时间:2014-11-21 10:53:10

标签: javascript node.js https cryptojs

我正在尝试通过附加.pfx证书和密码来向HTTPS服务器发送请求。但是,我收到了这个错误:

crypto.js:145
  c.context.loadPKCS12(pfx);
            ^
Error: wrong tag
at Object.exports.createCredentials (crypto.js:145:17)
at Object.exports.connect (tls.js:1331:27)
at Object.createConnection (https.js:79:14)
at new ClientRequest (http.js:1428:26)
at Object.exports.request (https.js:123:10)
at Object.<anonymous> (C:\Users\srmocher\Desktop\Webspaces.js:10:15)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)

这是我的代码:

var https=require('https');
var options={
    hostname:'https://<my-api>'
    method:'GET',
    pfx:"<pfx-data>",
    passphrase:"<pass>",
    agent:false
};
var req=https.request(options,function(res){
    res.on('data',function(d){
        console.log(d);
    })
});

如果有人能帮我理解错误,我很高兴。

0 个答案:

没有答案