【发布时间】:2012-04-06 08:12:12
【问题描述】:
我的商店中有一个 X509Certificate2 证书,我想使用 私钥导出到一个字节数组。证书字节数组必须是这样,当我稍后从字节数组导入证书时,私钥将具有私钥。
我尝试了很多方法,但没有成功导出带有私钥的证书。
X509Store store = new X509Store(StoreLocation.CurrentUser);
store.Open(OpenFlags.ReadOnly);
X509Certificate2 cert = store.Certificates[1];
byte[] certBytes = cert.GetRawCertData(); // Obviously does not work!
是否可以成功将带有私钥的证书导出到字节数组中?
非常感谢您的帮助。
【问题讨论】:
标签: c# x509 x509certificate2