3

I developed a Windows service application and in my app.config file I need to encrypt my password and decrypt in my application.

How can I do this ?

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
62071072SP
  • 1,963
  • 2
  • 19
  • 38
  • 5
    What have you tried? What documentation have you looked at that you do not understand? – Oded Dec 22 '11 at 10:03

1 Answers1

2

See Encrypting Passwords in a .NET app.config file to learn how to encrypt entire config sections.

If that's too much for you, then just use any decent reversible encryption algorithm (like AES, Blowfish) in .NET and store the encrypted username/password as a string in your config and decrypt it when you load the contents from the app.config file.

There are literally tons of samples out there, e.g. Encrypt/decrypt string in .NET right here on Stackoverflow showing how to use the Rijndael (a.k.a. AES) algorithm for your needs.

Community
  • 1
  • 1
marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459