X509证书未传输到服务器
我们有一个功能可以使用 C# 中的 X509 证书将文件发送到公共服务器,但问题是在接收端没有获取证书。我们收到一条 403.7 消息,指出未提供证书。 添加证书的代码如下:
try
{
X509Certificate certificate = X509Certificate.CreateFromCertFile(certificatePath);
httpWebRequest.ClientCertificates.Add(certificate);
}
catch (Exception CertificateException)
{
return "Failed to add certificate to post:" + certificatePath + " " + CertificateException.Message;
}
任何想法
We have a function to send files to a public server usin X509 cert in C#, but the issue is on the receiving end the cert is not being picked up. we get a 403.7 message saying cert not supplied.
the code to add the cert is as followed:
try
{
X509Certificate certificate = X509Certificate.CreateFromCertFile(certificatePath);
httpWebRequest.ClientCertificates.Add(certificate);
}
catch (Exception CertificateException)
{
return "Failed to add certificate to post:" + certificatePath + " " + CertificateException.Message;
}
any thoughts
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
证书有对应的私钥吗?
X509Certificate.CreateFromCertFile
不支持使用私钥加载证书。您需要使用私钥从证书存储中获取证书,或者从 PFX 文件中获取证书 - http://msdn.microsoft.com/en-us/library/ms148420.aspxDoes the certificate have a corresponding private key?
X509Certificate.CreateFromCertFile
doesn't support loading certificates with a private key. You need to get the certificate from a certificate store with the private key or maybe from a PFX file - http://msdn.microsoft.com/en-us/library/ms148420.aspx