-3

Possible Duplicate:
Simple 2 way encryption for C#

I want to encrypt data in my C# program, but want to be able to decrypt it later. Does anyone know of any library or tool that I can download that will enable me to do that?

Community
  • 1
  • 1
Sachin Kainth
  • 45,256
  • 81
  • 201
  • 304
  • 1
    You know, that is really not a common requirement for encryption schemes. I can help you with one-way encryption, if you like – sehe May 22 '12 at 11:21
  • Well, here is the first answer from stack overflow. If that isn't good, try one of the other thousand that come up when you search for c# encryption [see that search box up there?](http://stackoverflow.com/questions/202011/encrypt-decrypt-string-in-net) – Woody May 22 '12 at 11:23

4 Answers4

2

You can use Microsoft Enterprise Library there is an encryption block in it

Eugene Petrov
  • 651
  • 1
  • 5
  • 14
2

Take a look at the System.Security.Cryptography namespace. There's, for example, the TripleDESCryptoServiceProvider.

CodeCaster
  • 147,647
  • 23
  • 218
  • 272
1

There is a built in class for Cryptography

System.Security.Cryptography.RSACryptoServiceProvider

Please check this link RSACryptoServiceProvider

Vinod
  • 4,672
  • 4
  • 19
  • 26
1

If you take a look at the System.Security.Cryptography namespace in the documentation then you'll find classes for most of the common cryptographic systems.

There are two types of algorithm:

Public key (e.g. RSA) - you encrypt with a public key and then decrypt with a private key.

Symmetric key (e.g. AES, DES) - encryption and decryption is performed with the same key.

Which one to choose depends mainly on your situation. Symmetric key algorithms are typically used for encrypting data because they're faster, but that poses the problem of exchanging the key securely. If you can manually configure the endpoints of communication with the same key, then great. If not then you can either use public key to encrypt everything or - as is used in SSL, etc. - add in a handshake phase where the keys are exchanged via public key cryptography.

Moonshield
  • 925
  • 9
  • 16