PKI support in the .NET framework comes in the form of the RSACryptoServiceProvider class. However PKI is a standard used on all platforms not just .NET so interoperability is important. Strange, then, that the RSACryptoServiceProvider provides no mechanism to save the public and/or private key an RSACryptoServiceProvider instance in a portable format such as PEM.
RSAProviderPEMExchange class in the RSAProviderPEMExchange project aims to plug this gap. The class provides a set of extention methods to save the public or private key of an RSACryptoServiceProvider instance to a file or to create an RSACryptoServiceProvider from a public or private key stored in a .PEM file. The project also includes a demonstration of using the extension methods.
The project uses a subset of the BouncyCastle classes to create and read the PEM file content. The subset used is included in the project though if you are an existing BouncyCastle user you are able to remove the borrowed BC classes and revert to a full distribution.