AccessDeniedException X509Certificates C#

时间:2014-07-24 09:40:01

标签: c# digital-signature

我正在尝试使用证书throght .net库,特别是X509Certificates。

但AccessDeniedException在工作期间失败。

using System.Security.Cryptography.X509Certificates;

X509Certificate2 certificate = new X509Certificate2("C:\\AirAstana\\Project\\con\\AUTH_RSA_7525b02122ff0bd4561712317510a376b8c7cd1b.p12", "pass", X509KeyStorageFlags.Exportable); 
byte[] certData = certificate.Export(X509ContentType.Pkcs12, "pass"); 

Convert.ToBase64String(certData) 

有什么问题?

关注错误

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<soap:Fault>
<faultcode>soap:Server</faultcode>
<faultstring>CERTIFICATE_NOT_VALID</faultstring>
<detail>
<ns2:AccessDeniedException xmlns:ns2="http://ru.uss.esf/">
<description>CERTIFICATE_NOT_VALID</description>
</ns2:AccessDeniedException></detail>
</soap:Fault>
</soap:Body>
</soap:Envelope>

1 个答案:

答案 0 :(得分:1)

我认为该路径无效:

  

C:\阿斯塔纳航空\项目\ ** ** CON \ AUTH .....

CON是Windows中的保留字,您必须尝试更改它。