SSL对等验证问题 [英] SSL Peer Verification Problem

查看:102
本文介绍了SSL对等验证问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



在我的C#应用​​程序中,我必须通过https调用Web服务,并使用".crt"文件执行对等验证.如果我添加request.ClientCertificates.Add(x5092Obj);然后我得到异常:

Hi,

In my C# application, I got to call web service via https and perform peer verification using a ".crt" file. If I add request.ClientCertificates.Add(x5092Obj); then I get exception :

WEB Excep : The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel.
 STATUS = TrustFailure
 STACK =   at System.Net.HttpWebRequest.GetRequestStream(TransportContext& context)
   at System.Net.HttpWebRequest.GetRequestStream()


如果我添加


If I add

ServicePointManager.ServerCertificateValidationCallback += new RemoteCertificateValidationCallback(customXertificateValidation);


返回true,那么即使我删除了request.ClientCertificates.Add行,它也可以正常工作.

如果在任何情况下,我都必须在ServerCertificateValidationCallback中返回true,并且没有该请求就无法从服务器接收客户端.如果我添加了我想使用的.crt文件,那是没有意义的.

如何使用.crt文件并确认证书有效?有什么可以帮助我的.我对此进行了大量研究,但无法做到这一点.现在急着解决这个问题.任何帮助,指导均深表感谢.

谢谢


that returns true, then it works perfectly even if I remove the request.ClientCertificates.Add line.

If in any circumstances, I got to return true in ServerCertificateValidationCallback and without that request can''t receive the client from server. If I add that the .crt file that I am suppossed to use makes no sense.

How do I use the .crt file and confirm that the certificate is valid ? Can any on help me out. I did lots of research on this but couldn''t get things to its point. Now am in a hurry to solve the problem. Any help, guidance is highly appreciated.

Thanks

推荐答案

朋友,

我已经解决了问题.在这里没有任何回音的情况下,请考虑与所有人共享此过程.您可以通过 SSL对等方,了解如何通过HTTPS使用Web服务解决SSL对等方验证.验证 [^ ]

希望对您有所帮助.
Friends,

I have solved the problem. Looking at no responses here, thought to share the procedure with all of you over here. You can get to know how to work out with Web Services via HTTPS taking care of SSL Peer Verification at : SSL Peer Verification[^]

Hope it helps.


这篇关于SSL对等验证问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆