当运行以下代码时,会出现什么问题:
X509Certificate2 cert = new X509Certificate2(@"C:\file.p12", "password", X509KeyStorageFlags.Exportable);
RSACryptoServiceProvider crypt = (RSACryptoServiceProvider)cert.PrivateKey;
我得到了以下错误:
密钥集不存在
。我还没有将证书添加到存储中,这是访问私钥所必需的吗?
当运行以下代码时,会出现什么问题:
X509Certificate2 cert = new X509Certificate2(@"C:\file.p12", "password", X509KeyStorageFlags.Exportable);
RSACryptoServiceProvider crypt = (RSACryptoServiceProvider)cert.PrivateKey;
密钥集不存在
。X509Certificate2 cert = new X509Certificate2(@"C:\file.p12", "password",
X509KeyStorageFlags.Exportable | X509KeyStorageFlags.PersistKeySet);
RSACryptoServiceProvider crypt = (RSACryptoServiceProvider)cert.PrivateKey;