views:

169

answers:

2

I need to encrypt bytecode to send over a connection to a webservice, preferably using a GUID as a key. I have done a bit of research and found several classes developed for a similar purpose, but haven't been able to turn up much that is built into the Windows libraries. My question is: Is there something built in to C# that performs this task? If there is not, I would very much appreciate any suggestions as to implementation.

Edit: After reading this post http://stackoverflow.com/questions/1228451/when-would-i-choose-aescryptoserviceprovider-over-aesmanaged-or-rijndaelmanaged/1548622 I am going with AESCryptoServiceProvider.

+7  A: 

You should check out the System.Security.Cryptography namespace.

It's not clear whether you're in a position to choose which algorithm etc to use, but you might consider one of the following asymmetric algorithms:

There are also implementations of DES and RC2, but I would probably ignore them unless you're forced to use them.

LukeH
Thanks. I found the MSDN doc on System.Security.Cryptography classes and have looked through all of the secret key implementations. Is there anything in particular that I should know about the three you recommended? I do get to choose, so if you (or anyone else who reads this) have experience with them I would appreciate the input.
badpanda
@badpanda: I'm no expert, but I would personally choose AES simply because it's seen as the standard modern algorithm. (AES is essentially the same as Rijndael, but Rijndael allows some configurations which weren't included in the AES standard. TripleDES is still widely used, but newer algorithms such as AES are widely viewed as being faster and more secure.)
LukeH
+1  A: 

Have a look here it is written VB.net but the concept is the same

Yassir