title: RSA: How to generate private key in java and use it in C#?
body: <p>I would like to generate private key in java, save it as a 64 base encoded string in some file
  and then encrypt some phrase in C# using this saved file.
  I know to generate keys in java and encode it with 64 base.
  My question is how do I use this key in C#?
  This is a java code prototype to save private key into text file:</p>
  
  <pre><code>KeyPairGenerator keyGen = KeyPairGenerator.getInstance("RSA");
  RSAKeyGenParameterSpec spec = new RSAKeyGenParameterSpec(1024, RSAKeyGenParameterSpec.F4);
  keyGen.initialize(spec);
  KeyPair keyPair = keyGen.generateKeyPair();
  PrivateKey privateKey = keyPair.getPrivate();
  writeToFile("privateKey", Base64.encode(keyPair.getPrivate().getEncoded()));
  </code></pre>
  
  <p>I would like to implement following function in C# but can't find how to create RSAParameters or
  RSACryptoServiceProvider from private key</p>
  
  <pre><code> public static string DecryptData(string privateKey64Base, string data64Base)
   {
     // create using privateKey64Base
     // create RSACryptoServiceProvider rsa using RSAParameters above
     // byte[] encryptedData = rsa.Encrypt(Convert.FromBase64String(data64Base);
   }
  </code></pre>