简体   繁体   English

AccessDeniedException X509Certificates C#

[英]AccessDeniedException X509Certificates C#

I'm trying to work with certificate throght .net library, in particular X509Certificates. 我正在尝试使用.net库证书,尤其是X509Certificates。

But AccessDeniedException falls during work. 但是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) 

What is wrong? 怎么了?

Following error falls 跟随误差下降

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

I think that the path is not valid: 我认为该路径无效:

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

CON is a reserved word in Windows you must try to change it. CON是Windows中的保留字,您必须尝试对其进行更改。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM