C# RSA私钥解密问题

2024-12-18 23:12:37
推荐回答(1个)
回答1:

RSAPKCS1SignatureFormatter signe = new RSAPKCS1SignatureFormatter();
signe.SetKey(cer.PrivateKey);
signe.SetHashAlgorithm("SHA1");
byte[] reslut = signe.CreateSignature(hashbytes);

RSACryptoServiceProvider rsa1 = new RSACryptoServiceProvider();
rsa1.FromXmlString(key.ToXmlString(false)); //导入公钥
RSAPKCS1SignatureDeformatter RSADeformatter = new RSAPKCS1SignatureDeformatter(rsa1);
RSADeformatter.SetHashAlgorithm("SHA1");

RSACryptoServiceProvider oRSA1 = new RSACryptoServiceProvider();

oRSA1.FromXmlString(publickey);

主要还没不懂你什么意思,我也做过这个,就加解密和签名和验签。也用USBKEY!