X509Certificate.Export Method

Posted by klerik123456 on Stack Overflow See other posts from Stack Overflow or by klerik123456
Published on 2009-09-11T07:48:44Z Indexed on 2010/04/13 6:02 UTC
Read the original article Hit count: 946

Filed under:

I try export cert .pfx :

string certPath = "D:\\cert.pfx";
cert = new X509Certificate2(certPath, "pass");

byte[] certData = cert.Export(X509ContentType.Pfx,"pass"); /// **error in this line** 

X509Certificate newCert = new X509Certificate(certData,"pass");

But it finish with this error :

Key not valid for use in specified state.

Can somebody help me ?? Any solution as export certificate from store ??

© Stack Overflow or respective owner

Related posts about c#