title: RSA asymmentic encryption exception
body: <p>I using the following code to generate the public and private key for RSA encryption</p>
  
  <pre><code>  public static string RSA_Decrypt(string encryptedText, string privateKey)
          {
              CspParameters cspParams = new CspParameters { ProviderType = 1 };
              RSACryptoServiceProvider rsaProvider = new RSACryptoServiceProvider(cspParams);
  
              rsaProvider.ImportCspBlob(Convert.FromBase64String(privateKey));
  
              var buffer = Convert.FromBase64String(encryptedText);
  
              byte[] plainBytes = rsaProvider.Decrypt(buffer, false);
  
              string plainText = Encoding.UTF8.GetString(plainBytes, 0, plainBytes.Length);
  
              return plainText;
          }
  
          public static string RSA_Encrypt(string data, string publicKey)
          {
              CspParameters cspParams = new CspParameters { ProviderType = 1 };
              RSACryptoServiceProvider rsaProvider = new RSACryptoServiceProvider(cspParams);
  
              rsaProvider.ImportCspBlob(Convert.FromBase64String(publicKey));
  
              byte[] plainBytes = Encoding.UTF8.GetBytes(data);
              byte[] encryptedBytes = rsaProvider.Encrypt(plainBytes, false);
  
              return Convert.ToBase64String(encryptedBytes);
          }
  
          public static Tuple&lt;string, string&gt; CreateKeyPair()
          {
              CspParameters cspParams = new CspParameters { ProviderType = 1 /* PROV_RSA_FULL */ };
  
              RSACryptoServiceProvider rsaProvider = new RSACryptoServiceProvider(2048, cspParams);
  
              string publicKey = Convert.ToBase64String(rsaProvider.ExportCspBlob(false));
              string privateKey = Convert.ToBase64String(rsaProvider.ExportCspBlob(true));
  
              return new Tuple&lt;string, string&gt;(privateKey, publicKey);
          }
  </code></pre>
  
  <p>the decrypt function return this exception exception</p>
  
  <blockquote>
    <p>"key does not exist"</p>
  </blockquote>
  
  <p>please advice me to fix this issue. </p>