2011-10-19 88 views
1

我正在向HTTPS请求添加自签名X509证书。由于这是自签名,我得到的证书签名链中的错误c#ssl请求 - 证书验证

ssl_verify_client on; 

request.ClientCertificates.Add(new X509Certificate(@"key.pfx", "")); 

它正在与nginx的,有。所以我告诉c#忽略它。 (lambda执行并返回true)

ServicePointManager.ServerCertificateValidationCallback += 
           (sender, cert, chain, sslPolicyErrors) => true; 

但是,然后我从nginx得到以下错误。

400 Bad Request 
No required SSL certificate was sent 
nginx/1.0.5 

任何人都可以解释为什么这可能会发生?或者我可以如何追踪为什么?
我目前的想法:证书正在从http客户端中删除,因为它是自签名的?

另外:从C#

Step into: Stepping over method without symbols 'System.Net.Security.SecureChannel.VerifyRemoteCertificate' 
System.Net Information: 0 : [5516] SecureChannel#31534420 - Remote certificate has errors: 
System.Net Information: 0 : [5516] SecureChannel#31534420 -  A certificate chain processed, but terminated in a root certificate which is not trusted by the trust provider. 

System.Net Information: 0 : [5516] SecureChannel#31534420 - Remote certificate was verified as valid by the user. 

任何帮助最欢迎的一些输出诊断!谢谢, Chris

+0

我好像让你需要禁用的nginx的SSL验证的工作... – Yahia

+0

的一点是,我想nginx的验证。我只希望具有证书的客户端能够访问服务器。 – Chris

+0

不会工作......我不知道nginx是否有一些允许自签名证书的配置选项 - 如果有,那就是你想要的,那么你最好在serverfault.com上询问这个问题。否则,在nginx中将其转为nginx,然后在代码中对服务器上的客户端证书进行验证... – Yahia

回答

0

解决:需要ssl_verify_depth 1; ...

0

您需要在服务器上安装客户端证书并将服务器配置为信任它。我没有使用nginx的经验,所以我不能帮助你解决这个问题,但你需要将客户端证书放入服务器的可信证书存储区。