title: Construct RSACryptoServiceProvider from public key (not certificate)
body: <p>I am working on a project where I need to use a "public key" to encrypt a message using RSA algorithm. I was provided with a certificate and my first thought was to use Public Key from that certificate and after investigation I learned I need to use <code>RSACryptoServiceProvider</code> for encryption. </p>
  
  <p>I have checked msdn and only method I thought I should use is <code>RSACryptoServiceProvider.ImportCspBlob(byte[] keyBlob)</code>. 
  When I tried to use public key exported from certificate I was getting an error that the header data for certificate is invalid. </p>
  
  <p>I know I can cast <code>X509certificate2.PublicKey.Key</code> to <code>RSACryptoServiceProvider</code> but from what I understood from my client is that going forward I will be given only a public key and not the certificate. This key will have to be saved in .xml configuration file.</p>
  
  <p>So to summarize: Is there a way to generate an <code>RSACryptoServiceProvider</code> given only a certificate's public key?</p>