HttphelperBase.cs
里边的X509Certificate改为 X509Certificate2后问题解决了。
[C#] 纯文本查看 复制代码 /// <summary>
/// 设置证书
/// </summary>
/// <param name="item">参数类对象</param>
private void SetCer(HttpItem item)
{
if (!string.IsNullOrWhiteSpace(item.CerPath))
{
//将证书添加到请求里
if (!string.IsNullOrWhiteSpace(item.CerPwd))
{
request.ClientCertificates.Add(new X509Certificate2(item.CerPath, item.CerPwd));
}
else
{
request.ClientCertificates.Add(new X509Certificate2(item.CerPath));
}
}
}
/// <summary>
/// 设置多个证书
/// </summary>
/// <param name="item">参数类对象</param>
private void SetCerList(HttpItem item)
{
if (item.ClentCertificates != null && item.ClentCertificates.Count > 0)
{
foreach (X509Certificate2 c in item.ClentCertificates)
{
request.ClientCertificates.Add(c);
}
}
} |