高分求解如何解决System.Security.Cryptography.RSACryptoServiceProvider的效率问题
以下算法单线程执行需要0.2秒的执行时间,远远不能达到并发处理的要求。。
求解决方案。
public string RSAEncrypt(string m_strEncryptString)
{
try
{
byte[] PlainTextBArray;
byte[] CypherTextBArray;
string Result;
System.Security.Cryptography.RSACryptoServiceProvider rsa=new RSACryptoServiceProvider();
rsa.FromXmlString(xmlPublicKey);
PlainTextBArray = (new UnicodeEncoding()).GetBytes(m_strEncryptString);
CypherTextBArray = rsa.Encrypt(PlainTextBArray, false);
Result=Convert.ToBase64String(CypherTextBArray);
return Result;
}
catch(Exception ex)
{
throw ex;
}
}