我需要在 c# 中使用 RSA 算法加密/解密文件(类型 pdf、txt、doc)我从 XMl 文件导入密钥
我用这个方法
public byte[] DecryptData(byte[] encrypted)
{
int nBytes = encrypted.Length;
byte[] ByteArray = new byte[nBytes];
RSACryptoServiceProvider rsa=new RSACryptoServiceProvider();
StreamReader reader = new StreamReader(@"E:\test\keyStore\Receiver\PrivateKey.xml");
string PrivateKeyXML = reader.ReadToEnd();
rsa.FromXmlString(PrivateKeyXML);
reader.Close();
//store decrypt data
ByteArray = rsa.Decrypt(encrypted, false);
////convert bytes to string
//ss = Global.enc.GetString(fromEncrypt);
return ByteArray;
}
" ERROR MESSAGE="要解密的数据超过了这个模数的最大值 256 字节。"
请帮我