title: Create .pem file for public key RSA encryption C# .net
body: <p>I want to create <code>.pem</code> file for the public key generated by this method </p>
  
  <pre><code>public static Tuple&lt;string, string&gt; CreateKeyPair()
  {
      CspParameters cspParams = 
          new CspParameters { 
              ProviderType = 1 /* PROV_RSA_FULL */ 
          };
  
      RSACryptoServiceProvider rsaProvider = 
          new RSACryptoServiceProvider(1024, 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>Because I was generating this key for mobile application and they can not read it, they requested <code>.pem</code> file instead of public key as string</p>
  
  <p>Please advice,</p>