I am trying to export a .pfx certificate:
string certPath = "D:\\cert.pfx";
cert = new X509Certificate2(certPath, "pass");
byte[] certData = cert.Export(X509ContentType.Pfx,"pass");
X509Certificate newCert = new X509Certificate(certData,"pass");
But it ends with this error:
The key is not valid for use in the specified state.
Can someone help me? Any solution as an export certificate from the store
klerik123456
source
share