2006-09-11

.Net 2.0 RSA Encryption

Even though the new framework makes some tasks much easily, like openning a file in one line, other tasks, like encrypting data still require helper functions.
The classes all exist in the System.Security.Cryptography namespace:
http://msdn2.microsoft.com/en-us/library/system.security.cryptography.aspx
I have choosen to use RSA asymmetric encryption:
http://msdn2.microsoft.com/en-us/library/system.security.cryptography.rsacryptoserviceprovider.aspx

Many examples helped over the basic msdn documentation:
http://www.codeproject.com/dotnet/RSACryptoPad.asp
http://www.codeproject.com/dotnet/SimpleEncryption.asp
http://www.eggheadcafe.com/articles/20020630.asp
http://www.codeproject.com/dotnet/ComboEncryption.asp
http://blogs.msdn.com/lcris/archive/2006/05/08/592868.aspx

One of the annoying things to remember is that on a shared hosting server, you will most likely not have access to the underlying COM object directories. I thought this would be a show stopper, but this only restricts you from decrypting the values, you can still encrypt items fine. So if your requirement is to collect data and store it securely with a public key, then download it remotely and process it with the private key, this should work.

Some issues that may arise:
http://support.microsoft.com/default.aspx?scid=http://support.microsoft.com:80/support/kb/articles/q322/3/71.asp&NoWebContent=1