Ssl 如何在CE/WM-CF.NET3.5中获得X509Chain
这就是它在完整的.net上的外观Ssl 如何在CE/WM-CF.NET3.5中获得X509Chain,ssl,certificate,windows-mobile,compact-framework,windows-ce,Ssl,Certificate,Windows Mobile,Compact Framework,Windows Ce,这就是它在完整的.net上的外观 X509Chain ch = new X509Chain(); ch.Build(c); Debug.WriteLine("Chain Information.."); ... 我问这个问题的原因是因为我无法使用compact framework windows mobile app中的链接证书将数据发布到安全的https网站 有很多建议在HttpWebRequest调用期间覆盖ICertificatePolicy并为证书返回true…从安全角度来看,这是不可
X509Chain ch = new X509Chain();
ch.Build(c);
Debug.WriteLine("Chain Information..");
...
我问这个问题的原因是因为我无法使用compact framework windows mobile app中的链接证书将数据发布到安全的https网站
有很多建议在HttpWebRequest调用期间覆盖ICertificatePolicy并为证书返回true…从安全角度来看,这是不可接受的
public static bool ValidateServerCertificate(Object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors)
{
//accept all certs.
return true;
}
我的解决方案是通过比较链中每个证书的指纹与设备证书的指纹,遍历链并验证每个证书
这就是我想在CF中做的事情——如果证书有链或使用某种加密,而这种加密并没有在设备上实现,它就不起作用
string data = "hello";
Uri uri = new Uri("https://www.example.com/");
HttpWebRequest request = WebRequest.Create(uri) as HttpWebRequest;
request.Method = "POST";
request.ContentType = "application/x-www-form-urlencoded";
request.ContentLength = data.Length;
using (var stream = new StreamWriter(request.GetRequestStream())) {
stream.Write(data);
stream.Flush();
}
但由于ssl验证问题,这在GetRequestStream()上失败