简体   繁体   English

使用来自第三方的SSL证书时遇到麻烦

[英]trouble using SSL certificate from Third Party

I am developing a web service that communicates with a third parties web service. 我正在开发一种与第三方Web服务通信的Web服务。 the third party require that I use a SSL certificate with all communication to their system. 第三方要求我使用SSL证书并与他们的系统进行所有通信。

In my application I am loading the certificate from a file, "certificate.p12" for example, using the following code: 在我的应用程序中,我使用以下代码从文件“ certificate.p12”中加载证书:

Cert = new X509Certificate2(certPath, certPWD);

I then add it to my web request as follows: 然后,将其添加到我的Web请求中,如下所示:

webRequest.ClientCertificates.Add(Cert);

On my development machine this works perfectly, however, on the test server (which is housed externally in a data centre), I simply cannot get it to work. 在我的开发机器上,它可以完美地运行,但是,在测试服务器(位于数据中心的外部)中,我根本无法使其正常工作。

I've also tried putting the certificate into the certificate store in various locations, current user and local machine, and loaded it from there instead in the code. 我还尝试将证书放入当前用户和本地计算机的各个位置的证书存储中,然后从那里将其加载到代码中。 Same problem. 同样的问题。

Using the current version the application stops as it loads the file... I have debugging information before and after that line and it doesn't get past it but also doesn't throw any error. 使用当前版本,应用程序在加载文件时会停止...我在该行的前后都有调试信息,它不会越过它,也不会引发任何错误。

I'm very confused... any help is appreciated. 我很困惑...任何帮助表示赞赏。

Thanks. 谢谢。

Update : though I'm not 100% certain, I'm pretty sure I am getting an "object not set to an instance of a reference" error on this line 更新 :尽管我不确定100%,但是我很确定我在此行上遇到“对象未设置为引用实例”的错误

Cert = new X509Certificate2(certPath, certPWD);

Update 2 : 更新2

"Maybe the test machine is missing the certificate's root chain?" “也许测试机器缺少证书的根链?” - I think this is the problem. -我认为这是问题所在。 Just asked another guy in the office and the certificate was issued BY the third party and not an existing trusted source. 刚问了办公室里的另一个人,证书是由第三方而不是现有的受信任来源签发的。 On my local machine this doesn't seem to be a problem but I assume there is a higher level of security stopping this on the server... now looking at several options, 在我的本地计算机上,这似乎没有问题,但是我认为在服务器上阻止此问题的安全性更高……现在来看几个选项,

  1. can I bypass this security check for JUST this certificate as we know it to be trusted, 我可以绕过此安全检查,只是因为我们知道该证书是受信任的,
  2. can I get the root certificates from the third party and 我可以从第三方获得根证书吗?
  3. can I create the root certificates for the third party. 我可以为第三方创建根证书。

尝试联系数据中心的IT支持人员,并确保用于运行承载应用程序的进程的身份具有访问证书存储区所需的权限。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM