Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a .NET class to handle encryption?

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 When would I choose AesCryptoServiceProvider over AesManaged or RijndaelManaged? I am going with AESCryptoServiceProvider.

like image 656
badpanda Avatar asked Jun 11 '10 21:06

badpanda


People also ask

Which encryption is best in C#?

AES Encryption offers good performance and a good level of security. AES Encryption is a symmetric cipher and uses the same key for encryption and decryption.

What are the encryption techniques in C#?

Private key Encryption With private-key encryption, you encrypt a secret message using a key that only you know. To decrypt the message, you need to use the same key. Private-key cryptography is effective only if the key can be kept secret.

Which of the following classes can you use to perform symmetric encryption C#?

Symmetric encryption The CryptoStream class can be initialized using any class that derives from the Stream class, including FileStream, MemoryStream, and NetworkStream. Using these classes, you can perform symmetric encryption on a variety of stream objects.

What is the strongest encryption method?

AES 256-bit encryption is the strongest and most robust encryption standard that is commercially available today. While it is theoretically true that AES 256-bit encryption is harder to crack than AES 128-bit encryption, AES 128-bit encryption has never been cracked.


1 Answers

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 symmetric algorithms:

  • AES: AesManaged or AesCryptoServiceProvider
  • Rijndael: RijndaelManaged
  • Triple DES: TripleDESCryptoServiceProvider

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

like image 95
LukeH Avatar answered Sep 28 '22 14:09

LukeH