我有一个使用WCF 的WinForms应用程序,并作为参数传递给函数证书:
mySvcClient.SendDocument(cert.Export(X509ContentType.SerializedCert, "password"));
...
Run Code Online (Sandbox Code Playgroud)
在WCF服务中,我从字节数组重新创建了证书:
public void SendDocument (byte[] binaryCert)
{
X509Certificate2 cert = new X509Certificate2(binaryCert, "password");
...
Run Code Online (Sandbox Code Playgroud)
但是当使用证书签署xml时,我收到错误"Keyset不存在":
if (cert.HasPrivateKey) // WORKS!!!
{
signedXml.SigningKey = cert.PrivateKey; // THROW "keyset does not exist" EXCEPTION
...
Run Code Online (Sandbox Code Playgroud)
在我的电脑中,该应用程序100%工作!但是在WebServer中,我收到了这个错误!
问题是:即使X509Certificate2从一个字节数组重新创建,我需要一些特殊权限才能访问私钥?
谢谢!