从C#中的证书中提取公钥

时间:2012-08-30 05:51:52

标签: c# cryptography x509certificate digital-certificate rsacryptoserviceprovider

如何从x 509 v3证书获取私钥并将其存储在RSACryptoServiceProvider类中?

2 个答案:

答案 0 :(得分:1)

RSACryptoServiceProvider rsaCsp = (RSACryptoServiceProvider)x509certificateobject.PrivateKey;

假设您使用公钥,则只需将.PrivateKey更改为.PublicKey

答案 1 :(得分:0)

RSACryptoServiceProvider rsaCsp = (RSACryptoServiceProvider)x509certificateobject.PrivateKey;