X509Certificate 未传输到服务器 [英] X509Certificate not getting transmitted to the server

查看:33
本文介绍了X509Certificate 未传输到服务器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一个使用 C# 中的 X509 证书将文件发送到公共服务器的功能,但问题是在接收端没有收到证书.我们收到一条 403.7 消息,说未提供证书.添加证书的代码如下:

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;
        }

任何想法

推荐答案

证书有对应的私钥吗?X509Certificate.CreateFromCertFile 不支持使用私钥加载证书.您需要使用私钥从证书存储或 PFX 文件中获取证书 - http://msdn.microsoft.com/en-us/library/ms148420.aspx

Does 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

这篇关于X509Certificate 未传输到服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆