将
System.Security.Cryptography.RSACryptoServiceProvider rsa = new RSACryptoServiceProvider();
改为
CspParameters RSAParams = new CspParameters();
RSAParams.Flags = CspProviderFlags.UseMachineKeyStore;
System.Security.Cryptography.RSACryptoServiceProvider rsa = new RSACryptoServiceProvider(1024, RSAParams);