我有一個的WinForms應用程序消耗WCF,並作爲參數傳遞給函數的證書:X509證書 - 鍵集不存在
mySvcClient.SendDocument(cert.Export(X509ContentType.SerializedCert, "password"));
...
在WCF服務,我重新將證書從字節數組:
public void SendDocument (byte[] binaryCert)
{
X509Certificate2 cert = new X509Certificate2(binaryCert, "password");
...
但使用證書籤署XML時,我得到了錯誤「鍵集不存在」:
if (cert.HasPrivateKey) // WORKS!!!
{
signedXml.SigningKey = cert.PrivateKey; // THROW "keyset does not exist" EXCEPTION
...
在我的電腦中,應用程序工作100%!但在WebServer中,我得到了這個錯誤!
問題是:即使X509Certificate2從一個字節數組重新創建,我需要一些特殊的權限來訪問私鑰?
謝謝!
該鏈接可能會幫助你... http://stackoverflow.com/a/39223239/3857542 –