我正在 Windows Mobile 6 中工作,希望在与 Apache Web 服务器通信时进行客户端身份验证。我的本地证书存储中有一个证书,它应该相当简单:
X509Store myStore = new X509Store("MY", StoreLocation.CurrentUser);
myStore.Open(OpenFlags.ReadOnly);
X509Certificate2Collection certificates = myStore.Certificates;
X509Certificate2 clientcertificate;
foreach (X509Certificate 2certificate in certificates) {
clientcertificate = certificate; //omitted code to validate certificate
}
HttpWebRequest req = (HttpWebRequest)WebRequest.Create(webPage);
req.AllowWriteStreamBuffering = true;
req.AllowAutoRedirect = false;
req.Method = "POST";
req.ContentType = "text/xml";
req.Accept = "text/xml";
req.ClientCertificates.Add(clientcertificate);
Stream stream = req.GetRequestStream();
stream.Write(buffer, 0, buffer.Length);
stream.Close();
只要我删除“request.ClientCertificates.Add(客户端证书)”行,此代码段就可以工作。
插入后,我收到一条“无法为 SSL/TLS 建立安全通道”的消息。令人抓狂的是,当我在常规 .Net 框架中使用这个确切的代码时,它完美地传输了证书。
有谁知道这在紧凑框架中是否可行?如果我无法提供用于客户端身份验证的 X509Certificate,我应该采取哪些其他方法来确保身份验证正确(我应该有权访问 CAPI 或其他 Microsoft 加密模块)
Thanks.
可能是您的 Apache 服务器不支持安全连接。
例如,我在托管域上有一些网站,这些网站的成本很少或为零。我一直使用这些网站来测试代码。
但是,为了获得 SSL 功能,我必须每月支付 50 美元。因此,我无法在我的网站上测试这些内容。
要测试:如果 Apache 服务器支持 SSL,您应该能够将 URL 替换为 SSL 等效项:http://www.stackoverflow.com http://www.stackoverflow.com with https://www.stackoverflow.com https://www.stackoverflow.com
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)