【发布时间】:2011-04-10 03:15:37
【问题描述】:
我正在尝试将现有应用程序移植到 Mono 2.6.7/Linux。 一项任务是通过 WebClient 方法从具有 invalid SSL 证书的服务器接收数据。
我们在 Windows 下接受所有证书的 .Net 3.5 代码工作正常:
ServicePointManager.ServerCertificateValidationCallback = TrustCertificate;
StreamReader webReader = new StreamReader(webClient.OpenRead(url));
...
private static bool TrustCertificate(object sender, X509Certificate x509Certificate, X509Chain x509Chain, SslPolicyErrors sslPolicyErrors)
{
// all Certificates are accepted
return true;
}
我试过杂项。在 Mono 没有使用特定的 Mono dll 实现相同但总是相同的错误:
获取响应流时出错(写: 认证或解密有 失败。):发送失败
任何想法如何解决这个问题?
【问题讨论】: