title: how to read a RSA public key from a pem file OR xml file
body: <p>I have a simple thing to do : I want to encryt data using AES algorythm and a key contained in a pem file, like shown on the page :   <a href="http://msdn.microsoft.com/en-us/library/sb7w85t6.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/sb7w85t6.aspx</a> </p>
  
  <p>In this example, a new encryption key is created every time the function is run.
  But I need to read this key from either a pem file or an xml file but I can't find a way to do it.</p>
  
  <p>Is there a simple way to read a key from a pem file and convert it into a byte array (byte[]) ?</p>
  
  <p>I am using C# - .net Framework 3.5 and the key in the file is the RSA public key of our partner.</p>