System.Security.Cryptography.CryptographicException: 系统找不到指定的文件。

 System.Security.Cryptography.RSACryptoServiceProvider rsa = new RSACryptoServiceProvider(); 

改为

 CspParameters RSAParams = new CspParameters();
            RSAParams.Flags = CspProviderFlags.UseMachineKeyStore;

            System.Security.Cryptography.RSACryptoServiceProvider rsa = new RSACryptoServiceProvider(1024, RSAParams); 

原文地址:https://www.cnblogs.com/hyruur/p/2563460.html